Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions content/concerts/2022-helmstedt.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ address: Calvörder Str. 1A, 38350 Helmstedt
price: Eintritt frei (Hut)
draft: true
image: images/bg.jpg
lat : 52.2272555
long : 11.0297554
outputs:
- html
- calendar
Expand Down
9 changes: 9 additions & 0 deletions layouts/concerts/single.html
Original file line number Diff line number Diff line change
Expand Up @@ -32,5 +32,14 @@ <h1>{{ .Title }}</h1>
</ul>

{{ partial "posts/tags.html" .}}

{{ if not .Params.disableComments }}
{{ template "_internal/disqus.html" . }}
{{ end }}

{{ if and (.Params.lat) (.Params.long) }}
{{ partial "map" . }}
{{ end }}

</section>
{{ end }}
39 changes: 39 additions & 0 deletions layouts/partials/map.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
{{ $title := .Page.Title }}
{{ $lat := .Page.Params.lat }}
{{ $long := .Page.Params.long }}
<link rel="stylesheet" href="/assets/css/leaflet.css" />
<!-- TODO should use some kind of sensible css class settings -->
<div id="map" style="width: 100%; height: 580px;">
</div>
<script src="/assets/js/leaflet.js"></script>
<script src="/assets/js/leaflet-tilelayer-colorfilter.min.js"></script>
<script>
// Creating map options
var mapOptions = {
center: [{{ $lat }}, {{ $long }}],
// Zoom level of the map, larger = closer
zoom: 10,
};
// Creating a map object
var map = new L.map("map", mapOptions);
// Creating a colorFilter object
let niceGrayscaleFilter = [
'grayscale:100%',
'sepia:15%',
'brightness:95%',
];
// Creating a Layer object
var layer = L.tileLayer.colorFilter("http://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png", {
attribution: 'Map data &copy; <a href="https://www.openstreetmap.org/copyright">OpenStreetMap</a> contributors',
filter: niceGrayscaleFilter,
});
// Adding layer to the map
layer.addTo(map);

var marker = L.marker(L.latLng({{ $lat }}, {{ $long }}), {
title: {{ $title }},
});
marker.addTo(map);
marker.bindPopup({{ $title }}).openPopup();
</script>

10 changes: 10 additions & 0 deletions static/admin/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,16 @@ collections:
name: "image"
widget: "image"
required: false
- label: "Latitude"
name: "lat"
widget: "number"
value_type: "float"
required: false
- label: "Longitude"
name: "long"
widget: "number"
value_type: "float"
required: false
- label: "Body"
name: "body"
widget: "markdown"