Sorting by date

This commit is contained in:
Digital Studium 2023-10-14 13:52:02 +03:00
parent a42609c2e6
commit edd8fb9df1
3 changed files with 18 additions and 6 deletions

View File

@ -1,7 +1,9 @@
{% for section, urls in posts[language].items() %} {% for date, sections in posts[language].items() %}
{% for section, urls in sections.items() %}
{% if section != "/" %} {% if section != "/" %}
{% for url, post in urls.items() %} {% for url, post in urls.items() %}
{% include "components/post_summary.j2" %} {% include "components/post_summary.j2" %}
{% endfor %} {% endfor %}
{% endif %} {% endif %}
{% endfor %} {% endfor %}
{% endfor %}

View File

@ -1,3 +1,7 @@
{% for url, post in posts[language][section].items() %} {% for date, sections in posts[language].items() %}
{% if section in sections %}
{% for url, post in posts[language][date][section].items() %}
{% include "components/post_summary.j2" %} {% include "components/post_summary.j2" %}
{% endfor %} {% endfor %}
{% endif %}
{% endfor %}

View File

@ -1,11 +1,17 @@
<div class="sidebar"> <div class="sidebar">
<section> <section>
{% for section, urls in posts[language].items() %} {% set sections_list = [] %}
{% for date, sections in posts[language].items() %}
{% for section, urls in sections.items() %}
{% if section != "/" %} {% if section != "/" %}
<p> {% set sections_list = sections_list.append(section) %}
<a href="/{{ language}}/{{ section }}/">{{ translate(section, language) }} ({{ urls | length }})</a>
</p>
{% endif %} {% endif %}
{% endfor %} {% endfor %}
{% endfor %}
{% for section in sections_list | unique %}
<p>
<a href="/{{ language}}/{{ section }}/">{{ translate(section, language) }}</a>
</p>
{% endfor %}
</section> </section>
</div> </div>