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/blocks/markdown.html | 1 + templates/blocks/trail.html | 71 ++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 72 insertions(+) create mode 100644 templates/blocks/markdown.html create mode 100644 templates/blocks/trail.html (limited to 'templates/blocks') diff --git a/templates/blocks/markdown.html b/templates/blocks/markdown.html new file mode 100644 index 0000000..8ee0a42 --- /dev/null +++ b/templates/blocks/markdown.html @@ -0,0 +1 @@ +{{ this.text }} diff --git a/templates/blocks/trail.html b/templates/blocks/trail.html new file mode 100644 index 0000000..b32b7c1 --- /dev/null +++ b/templates/blocks/trail.html @@ -0,0 +1,71 @@ +{% set trail_gpx = record.attachments.get(this.trail_gpx) if this.trail_gpx else none %} +{% set activity_gpx = record.attachments.get(this.activity_gpx) if this.activity_gpx else none %} +{% if trail_gpx %} + {% set trail_gpx_url = trail_gpx | url(absolute=True, external=False) %} +{% endif %} +{% if activity_gpx %} + {% set activity_gpx_url = activity_gpx | url(absolute=True, external=False) %} +{% endif %} +{% if trail_gpx or activity_gpx %} + + Interactive map of the trail + + + Trail details + + + + + + + Distance: + + Time: + + Overall pace: + + + + Maximum elevation: + + Minimum elevation: + + Average elevation: + + + + Ascent: + + Descent: + + + + Average speed: + + Maximum speed: + + + + + + + Download the GPX track + + + + + + The interactive trail map could not be loaded. + + JavaScript is required to display the interactive trail map. + + +{% else %} + + Interactive map of the trail + The interactive trail map could not be loaded. + +{% endif %} -- cgit v1.3.1
+ Download the GPX track +
The interactive trail map could not be loaded.
JavaScript is required to display the interactive trail map.