Group posts by year
This commit is contained in:
parent
74422140aa
commit
4a2afa384e
|
@ -4,7 +4,25 @@ use:
|
|||
- posts
|
||||
---
|
||||
|
||||
{% set activeYear = false %}
|
||||
|
||||
{% for post in data.posts %}
|
||||
<a href="{{ post.url }}">{{ post.title }}</a>
|
||||
<br>
|
||||
{% set postYear = post.date|date('Y') %}
|
||||
|
||||
{% if postYear != activeYear %}
|
||||
{% if activeYear != false %}
|
||||
</ul>
|
||||
{% endif %}
|
||||
|
||||
{% set activeYear = postYear %}
|
||||
|
||||
<h2>{{ postYear }}</h2>
|
||||
|
||||
<ul>
|
||||
{% endif %}
|
||||
|
||||
<li>
|
||||
<a href="{{ post.url }}">{{ post.title }}</a>
|
||||
- {{ post.date|date('jS F Y') }}
|
||||
</li>
|
||||
{% endfor %}
|
||||
|
|
Loading…
Reference in a new issue