lvl0-website/themes/linkita/templates/archive.html

53 lines
1.9 KiB
HTML
Raw Normal View History

2025-07-10 20:07:36 +02:00
{% extends "index.html" %}
{% block main %}
{%- if page.extra.date_format %}
{%- set date_format_archive = page.extra.date_format %}
{%- elif section.extra.date_format %}
{%- set date_format_archive = section.extra.date_format %}
{%- else %}
{%- set date_format_archive = `%m-%d` %}
{%- endif %}
{%- if g_profile is defined %}
{% include "partials/profile.html" %}
{%- elif page.title %}
<h1 class="mb-16">{{ page.title }}</h1>
{%- elif section.title %}
<h1 class="mb-16">{{ section.title }}</h1>
{%- endif %}
{%- if page.content %}
<section>{{ page.content | safe }}</section>
{%- elif section.content %}
<section>{{ section.content | safe }}</section>
{%- endif %}
{%- if page.extra.section is defined %}
{%- set section = get_section(path=page.extra.section) %}
{%- endif %}
{%- if section.pages is undefined and paginator.pages is undefined %}
{{- throw(message="The archive page is missing the extra.section frontmatter variable!") }}
{%- endif %}
{%- for year, posts in section.pages | default(value=paginator.pages) | sort(attribute=`date`) | reverse | group_by(attribute=`year`) %}
<h2>{{ year }} <sup class="opacity-60">{{ posts | length }}</sup></h2>
<div class="not-prose pl-6">
<ul>
{%- for post in posts %}
<li>
<div class="my-2 flex items-center justify-between">
<a class="secondary-link" href="{{ m_url::rel(there=post.permalink, here=g_here, base=g_base) }}">{%
if post.title %}{{ post.title }}{% else %}{{ post.slug }}{% endif %}</a>
<time class="font-mono text-sm max-md:flex-none opacity-80" datetime="{{ post.date | date(format=`%+`) }}">{%
if config.extra.languages[lang].locale %}{{ post.date | date(format=date_format_archive,
locale=config.extra.languages[lang].locale) }}{%
else %}{{ post.date | date(format=date_format_archive) }}{% endif %}</time>
</div>
</li>
{%- endfor %}
</ul>
</div>
{%- endfor %}
{% endblock main %}