feat: Adding places tab with a map

This commit is contained in:
2026-03-30 22:32:17 +01:00
parent bde2392f5a
commit 29170aa80e
5 changed files with 84 additions and 1 deletions

3
content/places/_index.md Normal file
View File

@@ -0,0 +1,3 @@
+++
title = 'Places'
+++

View File

@@ -0,0 +1,20 @@
+++
title = 'Velvet Revival'
lon=-0.5598389213990184
lat=51.31993995350889
date = "2026-03-30"
author = "John Costa"
tags = ["Places", "Clothes", "Shops", "Woking"]
+++
[Velvet Revival](https://www.velvet-revival.co.uk/) is a vintage shop which sells up-cycled goods. It's in [Woking](https://en.wikipedia.org/wiki/Woking).
I found the selection to be great. I bought a [Carhartt](https://www.carhartt.com/en-gb/) t-shirt, which is very nice, and I suspect a new trend in my wardrobe.
If you're ever in Surrey, or fancy a stroll outside London (the train is 25 minutes), this is a cute little shop to visit.
### Flyer
| Front | Back |
| :--------------------------------------------------------------------------: | :------------------------------------------------------------------------: |
| ![Flyer Front](https://static.johncosta.tech/velvet-revival-flyer-front.jpg) | ![Flyer Back](https://static.johncosta.tech/velvet-revival-flyer-back.jpg) |

View File

@@ -22,6 +22,10 @@ theme = 'risotto'
weight = 10
name = 'Gists'
pageRef = '/gists'
[[menu.main]]
weight = 15
name = 'Places'
pageRef = '/places'
[params.about]
title = "John Costa"

View File

@@ -1,6 +1,6 @@
<h2>Recent Posts</h2>
<ul>
{{ range first 5 (where site.RegularPages "Section" "in" (slice "blog" "gists" "books-and-tv" "projects")) }}
{{ range first 5 (where site.RegularPages "Section" "in" (slice "blog" "gists" "books-and-tv" "projects" "places")) }}
<li><a href="{{ .RelPermalink }}">{{ .LinkTitle }}</a>{{ if .Date }}<p>{{ .Date.Format "2006-01-02" }}</p>{{ end }}</li>
{{ end }}
</ul>

56
layouts/places/list.html Normal file
View File

@@ -0,0 +1,56 @@
{{ define "main" }}
<h1 id="{{ .Title | urlize }}">{{ .Title | markdownify }}</h1>
{{ .Content }}
<link rel="stylesheet" href="https://unpkg.com/leaflet@1.9.4/dist/leaflet.css" integrity="sha256-p4NxAoJBhIIN+hmNHrzRCf9tD/miZyoHS5obTRR9BMY=" crossorigin="" />
<script src="https://unpkg.com/leaflet@1.9.4/dist/leaflet.js" integrity="sha256-20nQCchB9co0qIjJZRGuk2/Z9VM+kNiyxNV1lvTlZBo=" crossorigin=""></script>
<div id="map" style="height: 500px; width: 100%; border-radius: 4px; margin-bottom: 1rem;"></div>
<script>
var map = L.map('map').setView([30, 0], 2);
L.tileLayer('https://tile.openstreetmap.org/{z}/{x}/{y}.png', {
maxZoom: 19,
attribution: '&copy; <a href="https://www.openstreetmap.org/copyright">OpenStreetMap</a> contributors'
}).addTo(map);
var places = [
{{ range .Pages }}
{{ if and .Params.lat .Params.lon }}
{
title: {{ .Title }},
lat: {{ .Params.lat }},
lon: {{ .Params.lon }},
url: {{ .RelPermalink }}
},
{{ end }}
{{ end }}
];
var bounds = [];
places.forEach(function(place) {
var marker = L.marker([place.lat, place.lon]).addTo(map);
marker.bindPopup('<a href="' + place.url + '">' + place.title + '</a>');
bounds.push([place.lat, place.lon]);
});
if (bounds.length > 0) {
map.fitBounds(bounds, { padding: [50, 50] });
}
</script>
<ul>
{{ range .Pages.ByDate.Reverse }}
{{ .Render "li" }}
{{ end }}
</ul>
{{ end }}
{{ define "aside" }}
{{ if .Params.description }}
<p>{{ .Params.description }}</p>
{{ end }}
{{ end }}