summaryrefslogtreecommitdiffstats
path: root/templates
diff options
context:
space:
mode:
authorJan Tuomi <jan@jantuomi.fi>2026-01-01 17:36:39 +0200
committerJan Tuomi <jan@jantuomi.fi>2026-01-02 16:21:05 +0200
commitc1856d1f3edbc4b32be5860233dede88db16a7bb (patch)
treeb3a5e2f600c0079bd04d7ab2bb459b4664ba66a1 /templates
parent6d7e34af89ef1038d213ff8ea325bb84d4a00d4a (diff)
Start migrating content
Diffstat (limited to 'templates')
-rw-r--r--templates/atom.xml68
-rw-r--r--templates/base.html2
-rw-r--r--templates/feed.xml1
-rw-r--r--templates/index.html2
-rw-r--r--templates/macros.html16
-rw-r--r--templates/page.html38
-rw-r--r--templates/section.html20
-rw-r--r--templates/shortcodes/fig.html4
-rw-r--r--templates/shortcodes/toc.html1
9 files changed, 116 insertions, 36 deletions
diff --git a/templates/atom.xml b/templates/atom.xml
new file mode 100644
index 0000000..b1721ce
--- /dev/null
+++ b/templates/atom.xml
@@ -0,0 +1,68 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="{{ lang }}">
+ <title>{{ config.title }}
+ {%- if term %} - {{ term.name }}
+ {%- elif section.title %} - {{ section.title }}
+ {%- endif -%}
+ </title>
+ {%- if config.description %}
+ <subtitle>{{ config.description }}</subtitle>
+ {%- endif %}
+ <link rel="self" type="application/atom+xml" href="{{ feed_url | safe }}" />
+ <link
+ rel="alternate"
+ type="text/html"
+ href="
+ {%- if section -%}
+ {{ section.permalink | escape_xml | safe }}
+ {%- else -%}
+ {{ config.base_url | escape_xml | safe }}
+ {%- endif -%}
+ "
+ />
+ <generator uri="https://www.getzola.org/">Zola</generator>
+ {% if last_updated is defined %}<updated
+ >{{ last_updated | date(format="%+") }}</updated>{% endif %}
+ <id>{{ feed_url | safe }}</id>
+ {%- for page in pages %}
+ <entry xml:lang="{{ page.lang }}">
+ <title>{{ page.title }}</title>
+ <published>{{ page.date | date(format="%+") }}</published>
+ <updated
+ >{{ page.updated | default(value=page.date) | date(format="%+") }}</updated>
+ {% for author in page.authors %}
+ <author>
+ <name>
+ {{ author }}
+ </name>
+ </author>
+ {% else %}
+ <author>
+ <name>
+ {%- if config.author -%}
+ {{ config.author }}
+ {%- else -%}
+ Unknown
+ {%- endif -%}
+ </name>
+ </author>
+ {% endfor %}
+ <link
+ rel="alternate"
+ type="text/html"
+ href="{{ page.permalink | safe }}"
+ />
+ <id>{{ page.permalink | safe }}</id>
+ {% if page.summary %}
+ <summary type="html">{{ page.summary }}</summary>
+ {% else %}
+ <content
+ type="html"
+ xml:base="{{ page.permalink | escape_xml | safe }}"
+ >
+ {{ page.content }}
+ </content>
+ {% endif %}
+ </entry>
+ {%- endfor %}
+</feed>
diff --git a/templates/base.html b/templates/base.html
index c000c1b..de01e9c 100644
--- a/templates/base.html
+++ b/templates/base.html
@@ -61,8 +61,8 @@
font-style: italic;
}
</style>
-
<link rel="stylesheet" href="/style.css" />
+
<link
rel="alternate"
type="application/atom+xml"
diff --git a/templates/feed.xml b/templates/feed.xml
new file mode 100644
index 0000000..4eaed63
--- /dev/null
+++ b/templates/feed.xml
@@ -0,0 +1 @@
+{% include "atom.xml" %}
diff --git a/templates/index.html b/templates/index.html
index fdcd433..31d0a90 100644
--- a/templates/index.html
+++ b/templates/index.html
@@ -13,7 +13,7 @@
<section class="latest-posts">
<h2>Latest posts</h2>
<ul class="archive-list">
-{% for page in posts.pages %}
+{% for page in posts.pages | slice(end=3) %}
<li class="archive-entry">
<a href="{{ page.path }}">{{ page.title }}</a>
<small>({{ page.date | date(format="%Y-%m-%d") }})</small>
diff --git a/templates/macros.html b/templates/macros.html
new file mode 100644
index 0000000..cb5efdc
--- /dev/null
+++ b/templates/macros.html
@@ -0,0 +1,16 @@
+{% macro toc(page) %}
+<nav class="toc">
+ <ul>
+ {% for h in page.toc %}
+ <li><a href="{{ h.permalink }}">{{ h.title }}</a></li>
+ {% if h.children %}
+ <ul>
+ {% for c in h.children %}
+ <li><a href="{{ c.permalink }}">{{ c.title }}</a></li>
+ {% endfor %}
+ </ul>
+ {% endif %}
+ {% endfor %}
+ </ul>
+</nav>
+{% endmacro %}
diff --git a/templates/page.html b/templates/page.html
index 19f42a7..7120590 100644
--- a/templates/page.html
+++ b/templates/page.html
@@ -1,41 +1,21 @@
-{% extends "base.html" %} {% block content %}
+{% extends "base.html" %}
+{% import "macros.html" as macros %}
+{% block content %}
<h1>
{{ page.title }}<br />
- <small>{{ page.date }}</small>
+ <small>({{ page.date }})</small>
<small>[{{ page.extra.kind }}]</small>
</h1>
-{% block lede %}
-<p>{{ page.description }}</p>
-{% endblock %}
-
-{% block toc %}
-<ul>
- {% for h1 in page.toc %}
- <li><a href="#{{ h1.id }}">{{ h1.title }}</a></li>
- <ul>
- {% for h2 in h1.children %}
- <li><a href="#{{ h2.id }}">{{ h2.title }}</a></li>
- <ul>
- {% for h3 in h2.children %}
- <li><a href="#{{ h3.id }}">{{ h3.title }}</a></li>
- {% endfor %}
- </ul>
- {% endfor %}
- </ul>
- {% endfor %}
-</ul>
-{% endblock %}
-
-{{ page.content | safe }}
+{{ page.content | replace(from="<!-- toc -->", to=macros::toc(page=page)) | safe }}
<nav class="post-nav" aria-label="Post navigation">
- {% if page.lower %}
- <div class="post-nav-left"><a class="post-nav-link" href="{{ page.lower.permalink }}">← {{ page.lower.title }}</a></div>
- {% endif %}
{% if page.higher %}
- <div class="post-nav-right"><a class="post-nav-link" href="{{ page.higher.permalink }}">{{ page.higher.title }} →</a></div>
+ <div class="post-nav-left"><a class="post-nav-link" href="{{ page.higher.permalink }}">← {{ page.higher.title }}</a></div>
+ {% endif %}
+ {% if page.lower %}
+ <div class="post-nav-right"><a class="post-nav-link" href="{{ page.lower.permalink }}">{{ page.lower.title }} →</a></div>
{% endif %}
</nav>
diff --git a/templates/section.html b/templates/section.html
index c9ed8b1..b72f536 100644
--- a/templates/section.html
+++ b/templates/section.html
@@ -1,8 +1,18 @@
-{% extends "base.html" %} {% block content %}
+{% extends "base.html" %} {% block content %} {% set posts =
+get_section(path="posts/_index.md") %}
<h1>{{ section.title }}</h1>
-{% for page in section.pages %}
-<ul>
- <li><a href="{{ page.path }}">{{ page.title }}</a></li>
+<p>
+ Follow via <a href="/atom.xml">Atom/RSS</a> (<a
+ href="https://aboutfeeds.com/"
+ >Huh?</a
+ >)
+</p>
+<ul class="archive-list">
+ {% for page in posts.pages %}
+ <li class="archive-entry">
+ <a href="{{ page.path }}">{{ page.title }}</a>
+ <small>({{ page.date | date(format="%Y-%m-%d") }})</small>
+ </li>
+ {% endfor %} {% endblock %}
</ul>
-{% endfor %} {% endblock %}
diff --git a/templates/shortcodes/fig.html b/templates/shortcodes/fig.html
new file mode 100644
index 0000000..4ac99b4
--- /dev/null
+++ b/templates/shortcodes/fig.html
@@ -0,0 +1,4 @@
+<figure>
+ <img src="{{ src }}" alt="{{ alt }}" />
+ <figcaption aria-hidden="true">{{ alt }}</figcaption>
+</figure>
diff --git a/templates/shortcodes/toc.html b/templates/shortcodes/toc.html
new file mode 100644
index 0000000..479abec
--- /dev/null
+++ b/templates/shortcodes/toc.html
@@ -0,0 +1 @@
+<!-- toc -->