mirror of
https://gitlab.com/mrubli/hugo-mod-leaflet.git
synced 2025-10-07 01:54:24 +00:00
20 lines
530 B
HTML
20 lines
530 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 "id") }}
|
|
{{ errorf "%s: missing 'id' parameter: %s" .Name .Position }}
|
|
{{ end }}
|
|
|
|
{{ $uniqueMapId := .Parent.Ordinal | safeJS }}
|
|
|
|
{{ $id := .Get "id" }}
|
|
<script>
|
|
map_options_{{ $uniqueMapId }}.layers.enabled.push({{ $id }});
|
|
map_options_{{ $uniqueMapId }}.layers["{{ $id }}"] = {
|
|
{{ with .Get "apiKey" }}
|
|
apiKey: '{{ . }}',
|
|
{{ end }}
|
|
};
|
|
</script>
|