diff options
Diffstat (limited to '_layouts/posts_by_category.html')
-rw-r--r-- | _layouts/posts_by_category.html | 40 |
1 files changed, 40 insertions, 0 deletions
diff --git a/_layouts/posts_by_category.html b/_layouts/posts_by_category.html new file mode 100644 index 0000000..02892ee --- /dev/null +++ b/_layouts/posts_by_category.html @@ -0,0 +1,40 @@ +--- +layout: default +--- +<header class="post-header"> + <h1 class="post-title">Articles by category: {{ page.categories }}</h1> +</header> + +<div class="post-content"> + + <p>{{c_slug}}</p> + + + {% if site.categories[page.categories] %} + {% for post in site.categories[page.categories] %} + {% capture post_year %}{{ post.date | date: '%Y' }}{% endcapture %} + {% if forloop.first %} + <h4>{{ post_year }}</h4> + <div class="list-group"> + {% endif %} + + {% if forloop.first == false %} + {% assign previous_index = forloop.index0 | minus: 1 %} + {% capture previous_post_year %}{{ site.categories[page.categories][previous_index].date | date: '%Y' }}{% endcapture %} + {% if post_year != previous_post_year %} + </div> + <h4>{{ post_year }}</h4> + <div class="list-group"> + {% endif %} + {% endif %} + <ul class="posts"> + <li><a href="{{ post.url }}">{{ post.title }}</a> » <i><span>{{ post.date | date_to_string }}</span></i></li> + </ul> + {% if forloop.last %} + </div> + {% endif %} + {% endfor %} + {% else %} + <p>There are no posts in this categories.</p> + {% endif %} +</div>
\ No newline at end of file |