Omphaloskepsis-2/layouts/locations/list.html

83 lines
2.6 KiB
HTML
Raw Normal View History

2024-04-02 19:36:21 +00:00
{{ define "title" }}
Locations | {{ .Site.Title }}
{{ end }}
{{ define "main-class" }}--section location-map{{ end }}
{{ define "header-scripts" }}
2024-07-23 08:08:36 +00:00
<!-- Leaflet -->
<link rel="stylesheet" href="/css/leaflet/leaflet.css" />
<link rel="stylesheet" href="/js/leaflet-fullscreen/leaflet.fullscreen.css" />
2024-04-02 19:36:21 +00:00
{{ end }}
{{ define "footer-scripts" }}
2024-07-23 08:08:36 +00:00
<!-- Leaflet -->
<script src="/js/leaflet/leaflet.js"></script>
<!-- Leaflet Heat -->
<script src="/js/leaflet-heat/leaflet-heat.js"></script>
<!-- Leaflet Fullscreen -->
<script src="/js/leaflet-fullscreen/leaflet.fullscreen.min.js"></script>
2024-04-02 19:36:21 +00:00
<script>
2024-07-23 08:08:36 +00:00
var map = L.map('map', {
fullscreenControl: true
}).setView([55, -3], 3);
2024-04-02 19:36: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);
{{- $locations := partialCached "util/get_location_leaf_nodes.html.tmpl" $.Site.Data.locations -}}
2024-07-23 08:08:36 +00:00
{{/*
{{- range .Site.AllPages -}}
{{- with .Params.locations -}}
{{- range . -}}
{{- with ( index $locations ( replaceRE `, [A-Z]+` "" . ) ) -}}
L.marker([{{ .lat }}, {{ .lon }}]).addTo(map);
{{- end -}}
{{- end -}}
{{- end -}}
{{- end -}}
*/}}
2024-04-02 19:36:21 +00:00
L.heatLayer(
[
{{- range .Site.AllPages -}}
{{- with .Params.locations -}}
{{- range . -}}
{{- with ( index $locations ( replaceRE `, [A-Z]+` "" . ) ) -}}
[ {{ .lat }}, {{ .lon }} ],
{{- end -}}
{{- end -}}
{{- end -}}
{{- end -}}
],
{
minOpacity: 0.5,
2024-07-23 08:08:36 +00:00
gradient: {0.1: 'blue', 0.3: 'lime', 0.8: 'orange', 1: 'red'}
2024-04-02 19:36:21 +00:00
}
).addTo(map);
</script>
{{ end }}
{{ define "main-header" }}
<header class="site-content__header">
<h1 class="page-title">{{ .Title | safeHTML }}.</h1>
{{ .Content }}
</header>
{{ end }}
{{ define "main-body" }}
<article class="site-content__body site-content__body--chart">
<div id="map" style="width: 100%; height: 500px; margin: 0; display: block;"></div>
<section style="grid-area: section-content">
{{- partial "util/render_recursive_list.html.tmpl" ( dict "sc" $ "pc" . "items" $.Site.Data.locations "schemaType" "Place" ) -}}
</section>
</article>
{{ end }}