mirror of
https://github.com/Dichgrem/Blog.git
synced 2026-02-05 01:21:57 -05:00
feat:sort_by_year
This commit is contained in:
@@ -10,6 +10,22 @@
|
|||||||
|
|
||||||
{% set section = get_section(path="_index.md") %}
|
{% set section = get_section(path="_index.md") %}
|
||||||
|
|
||||||
{{ post_macros::list_posts(pages=section.pages) }}
|
{% set pages_by_year = section.pages | group_by(attribute="year") %}
|
||||||
|
{%- for year, pages_in_year in pages_by_year %}
|
||||||
|
<h2 class="year-divider">{{ year }}</h2>
|
||||||
|
<ul>
|
||||||
|
{%- for page in pages_in_year %}
|
||||||
|
{%- if page.draft %}
|
||||||
|
{% continue %}
|
||||||
|
{% endif -%}
|
||||||
|
<li class="post-list">
|
||||||
|
<a href="{{ page.permalink | safe }}">
|
||||||
|
<span class="post-date">{{ page.date }}</span>
|
||||||
|
:: <span class="post-list-title">{{ page.title }}</span></a>
|
||||||
|
{{ post_macros::tags(page=page, short=true) }}
|
||||||
|
</li>
|
||||||
|
{%- endfor %}
|
||||||
|
</ul>
|
||||||
|
{%- endfor %}
|
||||||
</div>
|
</div>
|
||||||
{% endblock content %}
|
{% endblock content %}
|
||||||
|
|||||||
Reference in New Issue
Block a user