Omphaloskepsis-2/layouts/cv/locations.html

65 lines
1.9 KiB
HTML
Raw Normal View History

2022-11-11 05:48:02 +00:00
{{ define "title" }}
CV by Location | {{ .Site.Title }}
{{ end }}
{{ define "main-class" }}--section location-map{{ end }}
2023-04-08 18:57:21 +00:00
{{ define "header-scripts" }}
2023-10-03 12:08:35 +00:00
<link rel="stylesheet" href="/css/leaflet.css"/>
2023-04-08 18:57:21 +00:00
{{ end }}
2022-11-11 05:48:02 +00:00
{{ define "footer-scripts" }}
2023-10-03 12:08:35 +00:00
<script src="/js/leaflet.js"></script>
2023-04-08 18:57:21 +00:00
<script src="/js/leaflet-heat.js"></script>
2022-11-11 05:48:02 +00:00
<script>
2023-10-03 12:08:35 +00:00
var map = L.map('map').setView([55, -3], 3);
2023-04-08 18:57:21 +00:00
L.tileLayer('https://tile.openstreetmap.org/{z}/{x}/{y}.png', {
maxZoom: 19,
attribution: '&copy; <a href="https://www.openstreetmap.org/copyright">OpenStreetMap</a>'
}).addTo(map);
2024-02-04 01:40:15 +00:00
{{- range $.Site.Data.locations -}}
/* L.marker([{{ .lat }}, {{ .lon }}]).addTo(map); */
{{- end -}}
2023-04-08 18:57:21 +00:00
2023-10-03 12:08:35 +00:00
L.heatLayer(
[
2024-02-04 01:40:15 +00:00
{{- range .Site.AllPages -}}
{{- with .Params.locations -}}
{{- range . -}}
{{- with ( index $.Site.Data.locations . ) -}}
[ {{ .lat }}, {{ .lon }} ],
{{- end -}}
{{- end -}}
{{- end -}}
2023-10-03 12:08:35 +00:00
{{- end -}}
],
{
2024-02-04 01:40:15 +00:00
minOpacity: 0.5,
gradient: {0.2: 'blue', 0.5: 'lime', 1: 'red'}
2023-04-08 18:57:21 +00:00
}
2023-10-03 12:08:35 +00:00
).addTo(map);
2022-11-11 05:48:02 +00:00
</script>
{{ end }}
{{ define "main-header" }}
<header class="site-content__header">
2024-02-04 01:40:15 +00:00
<h1 class="page-title">{{ .Title | safeHTML }}.</h1>
{{ .Content }}
2022-11-11 05:48:02 +00:00
</header>
{{ end }}
{{ define "main-body" }}
<article class="site-content__body site-content__body--chart">
2024-02-04 01:40:15 +00:00
<div id="map" style="width: 100%; height: 500px; margin: 0; display: block;"></div>
<ul style="grid-area: section-content">
{{- range $key, $value := $.Site.Data.locations -}}
<li itemscope itemtype="https://schema.org/Place">{{ $key }}</li>
{{- end -}}
</ul>
2022-11-11 05:48:02 +00:00
</article>
{{ end }}