This commit is contained in:
Ben Goldsworthy 2024-04-02 20:36:21 +01:00
parent 187900fd5b
commit 1fd9adcb52
No known key found for this signature in database
23 changed files with 1800 additions and 98 deletions

View file

@ -30,15 +30,16 @@
}).addTo(map);
var latLons = [];
{{ range . }}
{{ with ( index $.Site.Data.locations . ) }}
L.marker([{{ .lat }}, {{ .lon }}]).addTo(map);
latLons.push([{{ .lat }}, {{ .lon }}]);
{{ else }}
{{ erroridf "missing-lat-lon" "Could not find lat-lon for %q (%q)" . $.File.Path }}
{{ end }}
{{ end }}
{{ $locations := partialCached "util/get_location_leaf_nodes.html.tmpl" $.Site.Data.locations -}}
{{- range . -}}
{{- with ( index $locations ( replaceRE `, [A-Z]+` "" . ) ) -}}
L.marker([{{ .lat }}, {{ .lon }}]).addTo(map);
latLons.push([{{ .lat }}, {{ .lon }}]);
{{- else -}}
{{- erroridf "missing-lat-lon" "Could not find lat-lon for %q (%q)" . $.File.Path -}}
{{- end -}}
{{- end }}
map.fitBounds(latLons);
if (map.getZoom() < 10) map.setZoom(10);
</script>
@ -112,10 +113,19 @@
</div>
{{ with .Resources.GetMatch .Params.featured_image }}
<p class="attr">
{{ if .Params.attrlink }}<a href="{{ .Params.attrlink }}" target="_blank" rel="noopener">{{ end }}
{{- .Params.Attr | safeHTML -}}
{{ if .Params.attrlink }}</a>{{ end }}
{{ if .Params.attrlicence }} ({{ .Params.attrlicence }}){{ end }}
{{- if .Params.attrlink -}}<a href="{{ .Params.attrlink }}" target="_blank" rel="noopener">{{- end -}}
{{- .Params.attr | safeHTML -}}
{{- if .Params.attrlink -}}</a>{{- end -}}
{{- if .Params.attrlicence }} (
{{- with .Params.attrlicencelink -}}
<a href="{{ . }}" target="_blank" rel="noopener">
{{- end -}}
{{- .Params.attrlicence -}}
{{- with .Params.attrlicencelink -}}
</a>
{{- end -}}
)
{{- end -}}
<p>
{{ end }}
</div>