Добавлено разбиение заметок по годам

This commit is contained in:
Anton Vakhrushev 2019-08-29 18:06:42 +03:00
parent a0aba1e38c
commit 8d0cabf6fb

View File

@ -8,8 +8,20 @@ use: [articles]
<h1>{{ page.title }}</h1>
<ul>
{% for year in 2010..2030 %}
{% set items = [] %}
{% for article in data.articles %}
{% if article.date|date('Y') == year %}
{% set items = items|merge([article]) %}
{% endif %}
{% endfor %}
{% if items %}
<h2>{{ year }}</h2>
<ul>
{% for article in items %}
<li>
<p>
<a href="{{ article.url }}">{{ article.title }}</a>
@ -21,5 +33,8 @@ use: [articles]
</li>
{% endfor %}
</ul>
{% endif %}
{% endfor %}
{% endblock %}