adding tags and categories
This commit is contained in:
parent
1c960f4aa8
commit
a488bb0f59
16 changed files with 182 additions and 8 deletions
37
_layouts/blog_by_category.html
Normal file
37
_layouts/blog_by_category.html
Normal file
|
@ -0,0 +1,37 @@
|
|||
---
|
||||
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>
|
Loading…
Add table
Add a link
Reference in a new issue