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

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

View File

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