46 lines
1.8 KiB
HTML
46 lines
1.8 KiB
HTML
{{/*
|
|
Karten-Partial. Aufruf mit dict:
|
|
(dict "pages" <slice von Schauplatz-Seiten> "klein" false)
|
|
Baut den Leaflet-Container und bettet die Marker-Daten als JSON ein
|
|
(kein externer Request → CORS-frei, statisch). Der Filter kommt aus explorer.html.
|
|
*/}}
|
|
{{ $pages := .pages }}
|
|
{{ $klein := .klein }}
|
|
{{ $default := .markerColor | default site.Params.kategorieFarbeDefault | default "#1e2758" }}
|
|
|
|
{{/* Farb-Map (Kategorie → Hex) für map.js aus data/kategorien.yaml */}}
|
|
{{ $colorMap := dict }}
|
|
{{ range $k, $v := site.Data.kategorien }}{{ $colorMap = merge $colorMap (dict $k $v.color) }}{{ end }}
|
|
|
|
{{/* Marker-Daten aufbauen */}}
|
|
{{ $places := slice }}
|
|
{{ range $pages }}
|
|
{{ $img := "" }}
|
|
{{ with .Resources.GetMatch "{cover,*featured*,image}.*" }}{{ $img = .RelPermalink }}
|
|
{{ else }}{{ with .Params.image }}{{ $img = . | relURL }}{{ end }}{{ end }}
|
|
{{ if and .Params.lat .Params.lng }}
|
|
{{ $places = $places | append (dict
|
|
"title" .Title
|
|
"subtitle" (.Params.subtitle | default "")
|
|
"url" .RelPermalink
|
|
"lat" .Params.lat
|
|
"lng" .Params.lng
|
|
"categories" (.Params.kategorien | default slice)
|
|
"img" $img
|
|
) }}
|
|
{{ end }}
|
|
{{ end }}
|
|
|
|
{{ $payload := dict
|
|
"places" $places
|
|
"colors" $colorMap
|
|
"defaultColor" $default
|
|
"tileUrl" (site.Params.map.tileURL | default "https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png")
|
|
"attribution" (site.Params.map.attribution | default `© <a href="https://www.openstreetmap.org/copyright">OpenStreetMap</a>-Mitwirkende`)
|
|
}}
|
|
|
|
<div id="op-map" class="op-map{{ if $klein }} op-map--klein{{ end }}"
|
|
role="application" aria-label="{{ i18n "mapAria" }}"></div>
|
|
|
|
<script type="application/json" id="op-map-data">{{ $payload | jsonify | safeJS }}</script>
|