Create Index(Output) class and migrate index generation from Site

Like previous Content refactor, this allows validating file collisions
in the discover/write build pipeline.
This commit is contained in:
2026-08-12 21:57:57 +02:00
parent 61bc762256
commit f1451a17b4
4 changed files with 113 additions and 67 deletions
+8 -8
View File
@@ -1,6 +1,6 @@
{% extends "base.html" %}
{% set prefix = (section + "/") if section else (("tags/" + tag + "/") if tag else "") %}
{% set heading = section or tag or "" %}
{% set prefix = (label + "/") if kind == "section" else (("tags/" + label + "/") if kind == "tag" else "") %}
{% set heading = label or "" %}
{% block title %}{% if heading %}{{ heading }} — {% endif %}{{ site.name }}{% if page_num > 1 %} — Page {{ page_num }}{% endif %}{% endblock %}
@@ -10,16 +10,16 @@
{% endblock %}
{% block breadcrumb %}
{% if section %}
{% if kind == "section" %}
<nav aria-label="breadcrumb">
<a href="{{ site.base_dir }}">{{ site.name }}</a>
{{ section }}
{{ label }}
</nav>
{% elif tag %}
{% elif kind == "tag" %}
<nav aria-label="breadcrumb">
<a href="{{ site.base_dir }}">{{ site.name }}</a>
<a href="{{ site.base_dir }}tags/">Tags</a>
{{ tag }}
{{ label }}
</nav>
{% else %}
{{ super() }}
@@ -40,11 +40,11 @@
{% if total_pages > 1 %}
<nav>
{% if page_num > 1 %}
<a href="{{ site.base_dir }}{{ prefix }}page-{{ page_num - 1 }}.html">← Newer</a>
<a href="{{ site.base_dir }}{{ prefix }}{{ "" if page_num - 1 == 1 else "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 }}{{ prefix }}page-{{ p }}.html">{{ p }}</a>
{% else %}<a href="{{ site.base_dir }}{{ prefix }}{{ "" if p == 1 else "page-" ~ p ~ ".html" }}">{{ p }}</a>
{% endif %}
{% endfor %}
{% if page_num < total_pages %}