Add rendering of indices for the entire site and each section

This commit is contained in:
2026-08-06 00:25:07 +02:00
parent 1c919954e1
commit bfa4f8c2fa
3 changed files with 110 additions and 3 deletions
+31
View File
@@ -0,0 +1,31 @@
{% extends "base.html" %}
{% block title %}{% if section %}{{ section }} — {% endif %}{{ site.name }}{% if page_num > 1 %} — Page {{ page_num }}{% endif %}{% endblock %}
{% block main %}
{% if section %}<h1>{{ section }}</h1>{% endif %}
{% for item in items %}
<article>
<header>
<h2><a href="{{ site.base_dir }}{{ item.uri }}">{{ item.title }}</a></h2>
<time datetime="{{ item.created }}">{{ item.created }}</time>
</header>
{% if item.summary %}<p>{{ item.summary }}</p>{% endif %}
</article>
{% endfor %}
{% if total_pages > 1 %}
<nav>
{% if page_num > 1 %}
<a href="{{ site.base_dir }}{% if section %}{{ section }}/{% endif %}page-{{ page_num - 1 }}.html">← Newer</a>
{% endif %}
{% for p in range(1, total_pages + 1) %}
{% if p == page_num %}<strong>{{ p }}</strong>
{% else %}<a href="{{ site.base_dir }}{% if section %}{{ section }}/{% endif %}page-{{ p }}.html">{{ p }}</a>
{% endif %}
{% endfor %}
{% if page_num < total_pages %}
<a href="{{ site.base_dir }}{% if section %}{{ section }}/{% endif %}page-{{ page_num + 1 }}.html">Older →</a>
{% endif %}
</nav>
{% endif %}
{% endblock %}