2022-11-11 05:48:02 +00:00
{{ define "title" }}{{ .Title | plainify }} | {{ .Site.Title }}{{ end }}
{{ define "head-description" }}{{ .Summary | plainify }}{{ end }}
2023-08-07 22:23:46 +00:00
{{ define "main-class" }}--single layouts-default-single{{ end }}
{{ define "header-scripts" }}
{{ with .Params.locations }}
2024-07-23 08:08:36 +00:00
< script id = "Map-script" src = "/js/leaflet/leaflet.js" > < / script >
2023-08-07 22:23:46 +00:00
{{ end }}
{{ end }}
{{ define "header-styles" }}
{{ with .Params.styles }}
< link rel = "stylesheet" type = "text/css" href = "{{ ( $.Page.Resources.GetMatch " style " ) . RelPermalink } } " >
{{ end }}
{{ with .Params.locations }}
2024-07-23 08:08:36 +00:00
< link rel = "stylesheet" href = "/css/leaflet/leaflet.css" >
2023-08-07 22:23:46 +00:00
{{ end }}
{{ end }}
2022-11-11 05:48:02 +00:00
{{ define "footer-scripts" }}
{{ with .Params.locations }}
2023-08-07 22:23:46 +00:00
< script >
var map = L.map('map').setView([55, -3], 13);
2024-08-09 21:03:12 +00:00
L.tileLayer('https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', {
2023-08-07 22:23:46 +00:00
maxZoom: 19,
attribution: '© < a href = "https://www.openstreetmap.org/copyright" > OpenStreetMap< / a > '
}).addTo(map);
var latLons = [];
2024-04-02 19:36:21 +00:00
{{ $locations := partialCached "util/get_location_leaf_nodes.html.tmpl" $.Site.Data.locations -}}
{{- range . -}}
{{- with ( index $locations ( replaceRE `, [A-Z]+` "" . ) ) -}}
L.marker([{{ .lat }}, {{ .lon }}]).addTo(map);
latLons.push([{{ .lat }}, {{ .lon }}]);
{{- else -}}
{{- erroridf "missing-lat-lon" "Could not find lat-lon for %q (%q)" . $.File.Path -}}
{{- end -}}
{{- end }}
2023-08-07 22:23:46 +00:00
map.fitBounds(latLons);
< / script >
2022-11-11 05:48:02 +00:00
{{ end }}
{{ with .Params.scripts }}
2023-10-03 12:08:35 +00:00
{{ if in . "charts" }}
{{ $chartsConfigJS := $.Page.Resources.GetMatch "charts-init" | fingerprint }}
2024-07-23 08:08:36 +00:00
< script id = "Charts-script" src = "/js/chart/chart.js" > < / script >
2023-10-03 12:08:35 +00:00
< script id = "Charts-config-script" src = "{{ $chartsConfigJS.Permalink }}" integrity = "{{ $chartsConfigJS.Data.Integrity }}" > < / script >
2022-11-11 05:48:02 +00:00
{{ end }}
{{ end }}
{{ end }}
{{ define "main-header" }}
< header class = "site-content__header" >
< div class = "article-header__featured-image"
{{ if .Params.featured_image }}
{{ if .Resources.GetMatch .Params.featured_image }}
style="background-image: url({{ ( .Resources.GetMatch .Params.featured_image ).RelPermalink }})"
{{ else }}
style="background-image: url({{ .Params.featured_image }})"
{{ end }}
{{ end }}>
< div class = "article-header__title-wrapper" >
2023-07-01 03:16:59 +00:00
< h2 class = "article-header__title{{ if gt ( len ( .Title | plainify ) ) 40 }} article-header__title--long{{ end }}" >
2022-11-11 05:48:02 +00:00
< span role = "text" itemprop = "name" > {{ .Title | safeHTML }}< / span >
2023-07-01 03:16:59 +00:00
< / h2 >
{{ with .Params.subtitle }}
< p class = "article-header__subtitle" > {{ . | safeHTML }}< / p >
{{ end }}
2022-11-11 05:48:02 +00:00
< / div >
{{ with .Resources.GetMatch .Params.featured_image }}
< p class = "attr" >
2024-04-02 19:36:21 +00:00
{{- if .Params.attrlink -}}< a href = "{{ .Params.attrlink }}" target = "_blank" rel = "noopener" > {{- end -}}
{{- .Params.attr | safeHTML -}}
{{- if .Params.attrlink -}}< / a > {{- end -}}
{{- if .Params.attrlicence }} (
{{- with .Params.attrlicencelink -}}
< a href = "{{ . }}" target = "_blank" rel = "noopener" >
{{- end -}}
{{- .Params.attrlicence -}}
{{- with .Params.attrlicencelink -}}
< / a >
{{- end -}}
)
{{- end -}}
2022-11-11 05:48:02 +00:00
< p >
{{ end }}
< / div >
2024-07-23 08:08:36 +00:00
< p class = "article-header__word-count" > ~< span itemprop = "wordCount" > {{ .FuzzyWordCount | lang.FormatNumberCustom 0 }}< / span > words< / p >
< p class = "article-header__publish-date" > Published: < span itemprop = "datePublished" datetime = "{{ .PublishDate }}" > {{ .PublishDate.Format "January 2" }}< sup > {{ if in (slice 1 21 31) .PublishDate.Day}}st{{ else if in (slice 2 22) .PublishDate.Day}}nd{{ else if in (slice 3 23) .PublishDate.Day}}rd{{ else }}th{{ end }}< / sup > , 1{{ .PublishDate.Format "2006" | lang.FormatNumberCustom 0 }} < abbr style = "text-transform: small-caps; font-size: 0.8em;" title = "Holocene Era" > HE< / abbr > < / span > < / p >
< p class = "article-header__modified-date" > Last modified: < span itemprop = "dateModified" datetime = "{{ .Lastmod }}" > {{ .Lastmod.Format "January 2" }}< sup > {{ if in (slice 1 21 31) .Lastmod.Day}}st{{ else if in (slice 2 22) .Lastmod.Day}}nd{{ else if in (slice 3 23) .Lastmod.Day}}rd{{ else }}th{{ end }}< / sup > , 1{{ .Lastmod.Format "2006" | lang.FormatNumberCustom 0 }} < abbr style = "text-transform: small-caps; font-size: 0.8em;" title = "Holocene Era" > HE< / abbr > < / span > < / p >
2022-11-11 05:48:02 +00:00
{{ $post_age_in_years := math.Round ( div ( div ( now.Sub .PublishDate ).Hours 24 ) 365 ) }}
{{ if ( or .Params.site .Params.controversial ( gt $post_age_in_years 2 ) ) }}
< aside class = "article-header__warnings" >
< ul >
{{ if ( gt $post_age_in_years 2 ) }}< li > This piece was written < strong > over {{ $post_age_in_years }} years ago< / strong > . It may no longer accurately reflect my views now, or may be factually outdated.< / li > {{ end }}
{{ if .Params.controversial }}< li > This piece has been marked as potentially < strong > controversial< / strong > , whether due to the topic addressed, the content of the article, or both. Don't say you weren't warned.< / li > {{ end }}
{{ if .Params.site }}< li > This piece was originally written for an older version of this site. As such, it may not have transferred over properly and some images and links might be broken.< / li > {{ end }}
< / ul >
< / aside >
{{ end }}
{{ if .Params.notes }}
< aside class = "article-header__notes" >
< ul >
{{ range .Params.notes }}
< li > {{ . | safeHTML }}< / li >
{{ end }}
< / ul >
< / aside >
{{ end }}
{{ if and ( .TableOfContents ) ( ne .TableOfContents "< nav id = \"TableOfContents\" > < / nav > " ) }}
< nav class = "article-header__table-of-contents" >
2023-07-01 03:16:59 +00:00
< h3 class = "article-header__subtitle" > Table of Contents< / h3 >
2022-11-11 05:48:02 +00:00
{{ .TableOfContents }}
< / nav >
{{ end }}
< / header >
{{ end }}
{{ define "main-body" }}
2023-07-01 03:16:59 +00:00
< section class = "site-content__body" >
{{- if ( or .Params.internal_links .Params.external_links ) -}}
< section class = "article__links" >
{{- with .Params.internal_links -}}
< h3 > Internal Links< / h3 >
< ul >
{{- range . -}}
{{ if eq ( printf "%T" . ) "map[string]interface {}" }}
< li > < a href = "{{ .link }}" > {{ .title | safeHTML }}< / a > < / li >
{{ else }}
< li > < a href = "{{ . }}" > Link< / a > < / li >
{{ end }}
{{- end -}}
< / ul >
{{- end -}}
{{- with .Params.external_links -}}
< h3 > External Links< / h3 >
< ul >
{{- range . -}}
{{ if eq ( printf "%T" . ) "map[string]interface {}" }}
< li > < a href = "{{ .link }}" rel = "noopener noreferrer" target = "_blank" > {{ .title | safeHTML }}< / a > < / li >
{{ else }}
< li > < a href = "{{ . }}" rel = "noopener noreferrer" target = "_blank" > Link< / a > < / li >
{{ end }}
{{- end -}}
< / ul >
{{- end -}}
< / section >
{{- end -}}
2022-11-11 05:48:02 +00:00
{{ .Content }}
2023-07-01 03:16:59 +00:00
< / section >
2022-11-11 05:48:02 +00:00
{{ end }}
{{ define "main-footer" }}
{{ partial "post-meta.html" . }}
{{ end }}