--- layout: default --- <article class="page"> <h1>{{page.title}}</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>