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