From 1fe1d13c600b7dfe421b3b99b833b7d5d1232724 Mon Sep 17 00:00:00 2001 From: Dennis Fink Date: Thu, 23 Jul 2026 00:18:21 +0200 Subject: Add GPX trail maps to blog posts This adds a trail flow block so posts can include attached GPX files as interactive maps with route display, elevation charts, activity summaries, and start/finish markers. The trail assets are loaded only when needed, keeping the shared templates clean while vendoring the Leaflet dependencies required for offline, self-hosted map rendering. --- templates/macros/blog.html | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) (limited to 'templates/macros/blog.html') diff --git a/templates/macros/blog.html b/templates/macros/blog.html index 7f2ca60..13c2526 100644 --- a/templates/macros/blog.html +++ b/templates/macros/blog.html @@ -19,6 +19,16 @@ {% endmacro %} {% macro render_blog_post(post, show_toc=True) %} + {% set toc = namespace(items=[]) %} + + {% if show_toc and post.render_toc %} + {% for block in post.body.blocks %} + {% if block._flowblock == "markdown" and block.text %} + {% set toc.items = toc.items + (block.text.toc | default([])) %} + {% endif %} + {% endfor %} + {% endif %} +
@@ -68,8 +78,7 @@
{% if show_toc and post.render_toc %} - {% set toc = post.body.toc|default([]) %} - {{ render_toc(toc) }} + {{ render_toc(toc.items) }} {% endif %}
{{ post.body }}
-- cgit v1.3.1