summaryrefslogtreecommitdiffstats
path: root/templates_html/macros.html
diff options
context:
space:
mode:
authorJan Tuomi <jan@jantuomi.fi>2026-08-03 13:22:07 +0300
committerJan Tuomi <jan@jantuomi.fi>2026-08-03 13:22:07 +0300
commit23821211e03cd69cf87b2f264b48e0125fcac29d (patch)
tree42bd1a9fd7a8922a5351aed16309331d431acf7a /templates_html/macros.html
parent72a42e0449a0cbbbc455b36af9f53fc293c73fdf (diff)
Add gemini protocol
Diffstat (limited to 'templates_html/macros.html')
-rw-r--r--templates_html/macros.html45
1 files changed, 45 insertions, 0 deletions
diff --git a/templates_html/macros.html b/templates_html/macros.html
new file mode 100644
index 0000000..3922659
--- /dev/null
+++ b/templates_html/macros.html
@@ -0,0 +1,45 @@
+{% 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 %}
+
+{% macro linklog(page) %}
+{% set lh_data = load_data(path="linklog.json") %}
+<ul class="archive-list">
+{% for lh_post in lh_data.posts %}
+ <li class="archive-entry">
+ <a href="{{ lh_post.href }}">{{ lh_post.description }}</a>
+ <small>({{ lh_post.time | date(format='%Y-%m-%d') }})</small>
+ </li>
+{% endfor %}
+</ul>
+{% endmacro %}
+
+{% macro page_h1(page) %}
+<h1>
+ {{ page.title }}<br />
+ {% if page.date %}
+ <small>({{ page.date }})</small>
+ {% endif %}
+ {% if page.extra.kind %}
+ <small>[{{ page.extra.kind }}]</small>
+ {% endif %}
+</h1>
+{% endmacro %}
+
+{% macro page_content(page) %}
+{{ self::page_h1(page=page) }}
+{{ page.content | replace(from="<!-- toc -->", to=macros::toc(page=page)) | safe }}
+{% endmacro %}