This commit is contained in:
Holger Reinhardt 2016-01-04 21:49:37 +01:00
parent c50f2d4a16
commit 25707bb8a4
4 changed files with 47 additions and 38 deletions

View File

@ -1,37 +0,0 @@
---
layout: default
---
<header id="post-header">
<h1 id="post-title">{{ page.category }}</h1>
<h4 id="post-subtitle">Articles by category</h4>
</header>
<div id="post-content">
{% if site.categories[page.category] %}
{% for post in site.categories[page.category] %}
{% capture post_year %}{{ post.date | date: '%Y' }}{% endcapture %}
{% if forloop.first %}
<h3>{{ post_year }}</h3><div class="list-group">
{% endif %}
{% if forloop.first == false %}
{% assign previous_index = forloop.index0 | minus: 1 %}
{% capture previous_post_year %}{{ site.categories[page.category][previous_index].date | date: '%Y' }}{% endcapture %}
{% if post_year != previous_post_year %}
</div><h3>{{ post_year }}</h3><div class="list-group">
{% endif %}
{% endif %}
<a href="{{ post.url }}/" class="list-group-item">
<h4 class="list-group-item-heading">{{ post.title }}</h4>
</a>
{% if forloop.last %}
</div>
{% endif %}
{% endfor %}
{% else %}
<p>There are no posts in this category.</p>
{% endif %}
</div>

View File

@ -0,0 +1,44 @@
---
layout: default
---
<article class="page">
<h1>{{site.data.categories[page.category].name}}</h1>
<p class='info'>
<span>Articles by category</span>
</p>
<hr/>
<div id="post-content">
{% if site.categories[page.category] %}
{% for post in site.categories[page.category] %}
{% capture post_year %}{{ post.date | date: '%Y' }}{% endcapture %}
{% if forloop.first %}
<h3>{{ post_year }}</h3><ul>
{% endif %}
{% if forloop.first == false %}
{% assign previous_index = forloop.index0 | minus: 1 %}
{% capture previous_post_year %}{{ site.categories[page.category][previous_index].date | date: '%Y' }}{% endcapture %}
{% if post_year != previous_post_year %}
</div><h3>{{ post_year }}</h3><ul>
{% endif %}
{% endif %}
<li>
<a href="{{ post.url }}/" class="read-more">
{{ post.title }}
</a>
</li>
{% if forloop.last %}
</ul>
{% endif %}
{% endfor %}
{% else %}
<p>There are no posts in this category.</p>
{% endif %}
</div>
</article>

View File

@ -1,6 +1,8 @@
---
layout: blog_by_category
layout: page
title: 'Articles by category: general'
category: general
permalink: /meta/category/general/
---
## foobar