diff --git a/layouts/shortcodes/leaflet-elevation-profile.html b/layouts/shortcodes/leaflet-elevation-profile.html new file mode 100644 index 0000000..72a984f --- /dev/null +++ b/layouts/shortcodes/leaflet-elevation-profile.html @@ -0,0 +1,14 @@ +{{ if or (not .Parent) (not (eq .Parent.Name "leaflet-map")) }} +{{ errorf "%s: cannot be used outside leaflet-map: %s" .Name .Position }} +{{ end }} + +{{ $uniqueMapId := .Parent.Ordinal | safeJS }} + + diff --git a/layouts/shortcodes/leaflet-layer.html b/layouts/shortcodes/leaflet-layer.html new file mode 100644 index 0000000..82991fa --- /dev/null +++ b/layouts/shortcodes/leaflet-layer.html @@ -0,0 +1,19 @@ +{{ 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 "id") }} +{{ errorf "%s: missing 'id' parameter: %s" .Name .Position }} +{{ end }} + +{{ $uniqueMapId := .Parent.Ordinal | safeJS }} + +{{ $id := .Get "id" }} + diff --git a/layouts/shortcodes/leaflet-map.html b/layouts/shortcodes/leaflet-map.html new file mode 100644 index 0000000..339dbb7 --- /dev/null +++ b/layouts/shortcodes/leaflet-map.html @@ -0,0 +1,132 @@ +{{/* + +Syntax summary: + + {{< leaflet-map centerLat=FLOAT centerLon=FLOAT zoom=INT >}} + + {{< leaflet-layer id="STRING" apiKey="STRING" >}} + + {{< leaflet-marker lat=FLOAT lon=FLOAT >}} + + {{< leaflet-track path="URL" >}} + + {{< leaflet-scale >}} + + {{< leaflet-elevation-profile resizable=BOOL >}} + + {{< /leaflet-map >}} + +Map options: + + centerLat/centerLon: + Center point coordinates of the map as decimal values. Optional iif tracks or markers are given. + zoom: + Zoom level of the map. Optional iif tracks or markers are given. + +Layer options: + + id: + Name of the layer. Supported: + - openStreetMap: https://www.openstreetmap.org/ + - openCycleMap: https://www.thunderforest.com/maps/opencyclemap/ (*) + - outdoors: https://www.thunderforest.com/maps/outdoors/ (*) + - landscape: https://www.thunderforest.com/maps/landscape/ (*) + (*) API key required + apiKey: + API key for tile access. + +Marker options: + + lat/lon: + Coordinates of the marker as decimal values. + +Track options: + + path: + Absolute or relative path of the .gpx file to render as a track. + +Scale options: + + (none) + +Elevation profile options: + + resizable: + Boolean value indicating whether the elevation profile box should be drag & drop resizable. + Optional, defaults to false. + + Note: Elevation profiles are only supported if exactly one track is present. + +*/}} + +{{ $uniqueId := .Ordinal | safeJS }} + +