Files
hugo-mod-leaflet/layouts/shortcodes/leaflet-track.html
2023-12-30 18:56:28 +01:00

19 lines
615 B
HTML

{{ if or (not .Parent) (not (eq .Parent.Name "leaflet-map")) }}
{{ errorf "%s: cannot be used outside leaflet-map: %s" .Name .Position }}
{{ end }}
{{ if not (isset .Params "path") }}
{{ errorf "%s: missing 'path' parameter: %s" .Name .Position }}
{{ end }}
{{ $uniqueMapId := (printf "%s:%d" .Page.File.UniqueID .Parent.Ordinal) | md5 | safeJS }}
<script>
map_options_{{ $uniqueMapId }}.tracks.push({
source: {{ .Get "path" }},
title: {{ .Get "title" | default ("null" | safeJS) }},
// Internal use, ignored by quip-maps
downloadable: {{ .Get "downloadable" | default "true" | safeJS }},
})
</script>