yuki.k4w411.net/_layouts/recent_feed.njk
2025-10-24 10:23:55 -03:00

39 lines
1.6 KiB
Text

{#
possible variables:
- cycling_tag: collection tag to cycle through
- sidebar: .njk include file as sidebar [optional]
#}
{% extends "_layouts/base.njk" %}
{% block content %}
{% if sidebar %}
<div id="{{ sidebar }}-sidebar" class="sidebar">
{% include sidebar + "_sidebar.njk" %}
</div>
{% endif %}
<div id="feed">
{% set current_year = 0 %}
{% for post in collections[cycling_tag] | i18n_filter %}
<div class="feed-item">
{% set post_year = post.date | date("yyyy") %}
{% if post_year != current_year %}
<h2 class="year-title">{{ post_year }}</h2>
{% set current_year = post_year %}
{% endif %}
<h3 id="{{ post.data.title | slugify }}" class="post-title">{{ post.data.title }}</h3>
<p class="post-date">{{ post.date | date("dd/MM/yyyy") }}</p>
{#<p>Debug: {{ post.date }} -> {{ post.date | date("dd/MM/yyyy") }}</p>#}
{% if post.data.description %}
<p class="post-description">{{ post.data.description }}</p>
{% else %}
<p class="post-excerpt">{% excerpt post %}</p>
{% endif %}
<a href="{{ post.url | locale_url_resolve }}" class="post-link">{{ "read-more" | i18n }}</a>
{% if post.data.image %}
<img src="{{ post.data.image }}" alt="{{ post.data.image.alt }}" class="post-image">
{% endif %}
</div>
{% endfor %}
</div>
{% endblock content %}