Move the map JS out from the theme

This commit is contained in:
2024-02-11 09:30:59 +00:00
parent 82f2e2d667
commit 4d95f600c5
5 changed files with 23 additions and 11 deletions

View File

@@ -1,6 +1,7 @@
---
title: Visit Us
subtitle: Come take a look around.
layout: visit
---
Leigh Hackspace is located inside [Leigh Spinners Mill](https://www.spinnersmill.co.uk), a [Grade II* listed](https://historicengland.org.uk/advice/heritage-at-risk/search-register/list-entry/48399) former cotton spinning mill, restored by Leigh Building Preservation Trust and now hosting [multiple business and community projects](https://www.spinnersmill.co.uk).
@@ -18,7 +19,9 @@ Leigh
WN7 2LB
```
{{< map >}}
{{< rawhtml >}}
<div id="map" class="map"></div>
{{</ rawhtml >}}
What3Words: [//escape.shot.cleansed](https://what3words.com/escape.shots.cleansed) - This is for the main entrance of Mill 2.

19
layouts/page/visit.html Normal file
View File

@@ -0,0 +1,19 @@
{{ define "title" }}
{{ .Title }}
{{ end }}
{{ define "subtitle" }}
{{ .Params.subtitle }}
{{ end }}
{{ define "extra_css" }}
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/ol@v8.2.0/ol.css">
{{ end }}
{{ define "extra_js" }}
<script src="https://cdn.jsdelivr.net/npm/ol@v8.2.0/dist/ol.js"></script>
{{ end }}
{{ define "content" }}
{{ .Content }}
{{ end }}

View File

@@ -1,2 +0,0 @@
<div id="map" class="map"></div>
{{ .Page.Store.Set "hasMap" true }}

View File

@@ -8,11 +8,6 @@
</script>
{{ end }}
{{ if .Page.Store.Get "hasMap" }}
<script src="https://cdn.jsdelivr.net/npm/ol@v8.2.0/dist/ol.js"></script>
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/ol@v8.2.0/ol.css">
{{ end }}
{{ $theme := resources.Get "js/theme.js" }}
{{ $site := resources.Get "js/site.js" }}
{{ $js := slice $site $theme | resources.Concat "js/bundle.js" | resources.Minify }}

View File

@@ -19,9 +19,6 @@
<link rel="alternate" type="text/calendar" href="{{ .Site.Params.calendarUrl }}" title="{{ .Site.Title }} Events">
<link rel="canonical" href="{{ .Permalink }}">
{{ if .Page.Store.Get "hasMap" }}
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/ol@v8.2.0/ol.css">
{{ end }}
{{ $opts := dict "transpiler" "libsass" "targetPath" "css/leighhack.css" }}
{{ with resources.Get "sass/leighhack.scss" | toCSS $opts | minify | fingerprint }}
<link rel="stylesheet" href="{{ .RelPermalink }}" integrity="{{ .Data.Integrity }}" crossorigin="anonymous">