From 6f9ffd0b77da5bda8e8e8246a1076ec0d1b3360c Mon Sep 17 00:00:00 2001 From: Martin Rubli Date: Sat, 30 Dec 2023 14:32:58 +0100 Subject: [PATCH] layouts: map: Make tracks downloadable --- layouts/shortcodes/leaflet-map.html | 30 ++++++++++++++++++++++++++- layouts/shortcodes/leaflet-track.html | 7 ++++++- 2 files changed, 35 insertions(+), 2 deletions(-) diff --git a/layouts/shortcodes/leaflet-map.html b/layouts/shortcodes/leaflet-map.html index b8e2829..e899246 100644 --- a/layouts/shortcodes/leaflet-map.html +++ b/layouts/shortcodes/leaflet-map.html @@ -8,7 +8,7 @@ Syntax summary: {{< leaflet-marker lat=FLOAT lon=FLOAT >}} - {{< leaflet-track path="URL" >}} + {{< leaflet-track path="URL" title="STRING" downloadable=BOOL >}} {{< leaflet-scale >}} @@ -81,6 +81,11 @@ Track options: path: Absolute or relative path of the .gpx file to render as a track. + title: + Name of the track, used e.g. to render the 'Download GPX' button when multiple tracks are present. + downloadable: + Boolean value indicating whether there should be a 'Download GPX' button for this track. + Optional, defaults to true. Scale options: @@ -126,6 +131,8 @@ Elevation profile options:
+
+
diff --git a/layouts/shortcodes/leaflet-track.html b/layouts/shortcodes/leaflet-track.html index 6fc8372..78634d6 100644 --- a/layouts/shortcodes/leaflet-track.html +++ b/layouts/shortcodes/leaflet-track.html @@ -9,5 +9,10 @@ {{ $uniqueMapId := (printf "%s:%d" .Page.File.UniqueID .Parent.Ordinal) | md5 | safeJS }}