leilukin-tumbleblog/themes/umbra/pages/archive.twig

62 lines
2.0 KiB
Twig
Raw Normal View History

2024-06-20 14:10:42 +00:00
{% extends "layouts" ~ DIR ~ "default.twig" %}
{% block content %}
{# Months? (For yearly archives) #}
{% if months is not empty %}
<div class="archive standalone">
{% for when, month in months %}
<h2 id="label_{{ when }}_archive" class="archive">
<a href="{{ url('archive/%s/' | format(when | dateformat('Y/m'))) }}">
2024-09-05 17:51:48 +00:00
{{ when | time("F Y" | translate, "title") }}
2024-06-20 14:10:42 +00:00
</a>
</h2>
<ul aria-labelledby="label_{{ when }}_archive" class="archive">
{% for post in month %}
<li>
<article class="post archive {{ post.feather }}" id="post_{{ post.id }}" role="presentation">
<section class="post_archive_container" aria-hidden="true">
{% if post.image is defined %}
{{ post.image | thumbnail("", false, ["max_width=196", "quality=60", "square=1"], "196px") }}
{% else %}
{% if post.title is not empty %}
<h3 class="archive">{{ post.title | striptags | normalize | truncate(20) }}</h3>
{% endif %}
<p>{{ post.excerpt() | striptags | normalize | truncate(1000) | oneof(post.slug) }}</p>
{% endif %}
</section>
<a href="{{ post.url() }}" class="archive_post_link">
{{ "Permanent link to &#8220;%s&#8221;" | translate | format(post.title() | oneof(post.slug) | striptags | normalize | fix(true)) }}
</a>
</article>
</li>
{% endfor %}
</ul>
{% endfor %}
</div>
{% if archive.next is not empty %}
<div role="navigation" class="next traversal">
<a href="{{ url('archive/%s/' | format(archive.next | dateformat('Y'))) }}">
{{ archive.next | time("Y") }}
</a>
</div>
{% endif %}
{% endif %}
{# Posts? (For daily/monthly archives) #}
{% if posts.paginated is not empty %}
<div class="filter">
{{ "Archive of %s" | translate | format(archive.when | time(archive.depth == "day" ? "d F Y" : "F Y")) }}
</div>
{% for post in posts.paginated %}
{% include(["feathers" ~ DIR ~ post.feather ~ ".twig", "feathers" ~ DIR ~ "missing.twig"]) %}
{% endfor %}
{% endif %}
{# No results #}
{% if months is empty and posts.paginated is empty %}
<div role="status" class="filter">{{ "There aren't any posts in the timeframe you specified." | translate }}</div>
{% endif %}
{% endblock %}