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

71 lines
2.3 KiB
Twig

{% extends "layouts" ~ DIR ~ "default.twig" %}
{% block content %}
{# Months? (For yearly archives) #}
{% if months is not empty %}
{% if archive.prev is not empty %}
<div role="navigation" class="prev traversal">
<a href="{{ url('archive/%s/' | format(archive.prev | dateformat('Y'))) }}">
{{ "Archive of %s" | translate | format(archive.prev | time("Y")) }}
</a>
</div>
{% endif %}
<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'))) }}">
{{ when | time("F Y" | translate) | title }}
</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 of %s" | translate | format(archive.next | time("Y")) }}
</a>
</div>
{% endif %}
{% endif %}
{# Posts? (For daily/monthly archives) #}
{% if posts.paginated is not empty %}
<div class="ribbon">
{{ "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="ribbon">
{{ "There aren't any posts in the timeframe you specified." | translate }}
</div>
{% endif %}
{% endblock %}