Omphaloskepsis-2/layouts/blog/single.html

266 lines
11 KiB
HTML
Raw Normal View History

2022-11-11 05:48:02 +00:00
{{ define "title" }}
2023-08-22 10:14:33 +00:00
“{{ .Title | plainify }}” | {{ .Site.Title }}
2022-11-11 05:48:02 +00:00
{{ end }}
2023-08-07 22:23:46 +00:00
{{ define "main-class" }}--single layouts-blog-single{{ end }}
2022-11-11 05:48:02 +00:00
2023-07-01 03:16:59 +00:00
{{ define "header-scripts" }}
2023-08-22 10:14:33 +00:00
{{ with .Params.locations }}
2023-10-03 12:08:35 +00:00
<script id="Map-script" src="/js/leaflet.js"></script>
2023-08-22 10:14:33 +00:00
{{ end }}
2023-07-01 03:16:59 +00:00
{{ end }}
2023-04-08 18:57:21 +00:00
{{ define "header-styles" }}
2023-08-22 10:14:33 +00:00
{{ with .Params.styles }}
<link rel="stylesheet" type="text/css" href="{{ ( $.Page.Resources.GetMatch "style").RelPermalink }}">
{{ end }}
{{ with .Params.locations }}
<link rel="stylesheet" href="/css/leaflet.css">
{{ end }}
2023-04-08 18:57:21 +00:00
{{ end }}
2022-11-11 05:48:02 +00:00
{{ define "footer-scripts" }}
2023-08-22 10:14:33 +00:00
{{ with .Params.locations }}
<script>
var map = L.map('map').setView([55, -3], 13);
2023-07-01 03:16:59 +00:00
2023-08-22 10:14:33 +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);
2022-11-11 05:48:02 +00:00
2023-08-22 10:14:33 +00:00
var latLons = [];
{{ range . }}
{{ with ( index $.Site.Data.locations . ) }}
L.marker([{{ .lat }}, {{ .lon }}]).addTo(map);
latLons.push([{{ .lat }}, {{ .lon }}]);
{{ else }}
2023-10-03 12:08:35 +00:00
{{ erroridf "missing-lat-lon" "Could not find lat-lon for %q (%q)" . $.File.Path }}
2023-08-22 10:14:33 +00:00
{{ end }}
{{ end }}
2023-10-03 12:08:35 +00:00
2023-08-22 10:14:33 +00:00
map.fitBounds(latLons);
2023-10-03 12:08:35 +00:00
if (map.getZoom() < 10) map.setZoom(10);
2023-08-22 10:14:33 +00:00
</script>
{{ end }}
{{ with .Params.scripts }}
{{ if in . "mathjax" }}
<script src="/js/polyfill.js"></script>
<script id="MathJax-script" async src="/js/mathjax/tex-chtml.js"></script>
<script src="/js/mathjax/config.js"></script>
{{ end }}
{{ end }}
{{ if $.HasShortcode "chart" }}
2023-10-03 12:08:35 +00:00
{{ $chartsConfigJS := $.Page.Resources.GetMatch "charts-init" | fingerprint }}
<script id="Charts-script" src="/js/chart.js"></script>
<script id="Charts-config-script" src="{{ $chartsConfigJS.Permalink }}" integrity="{{ $chartsConfigJS.Data.Integrity }}"></script>
2023-08-22 10:14:33 +00:00
{{ end }}
2022-11-11 05:48:02 +00:00
{{ end }}
{{ define "main-header" }}
<header class="site-content__header">
{{ if .Params.series }}
<p class="article-header__series">Part of series:
{{ range ( .GetTerms "series" ) }}
2023-07-01 03:16:59 +00:00
<a class="u-url" href="{{ .RelPermalink }}">{{ .LinkTitle }}</a>
2022-11-11 05:48:02 +00:00
{{ end }}
</p>
{{ end }}
2023-07-01 03:16:59 +00:00
{{ with .Params.featured_image }}
<img class="u-photo" style="display: none;" src="
{{- with ( $.Resources.GetMatch . ) -}}
{{- if eq .MediaType.SubType "svg" -}}
{{- .RelPermalink -}}
{{- else }}
{{- with .Resize "1200x webp" -}}
{{- .RelPermalink -}}
{{- end -}}
{{- end -}}
{{- else -}}
{{- . -}}
{{- end -}}
"
itemprop="image"
{{- with ( $.Resources.GetMatch . ) -}}
alt="{{ .Params.alt }}"
{{- end -}}
/>
{{ end }}
2022-11-11 05:48:02 +00:00
<div class="article-header__featured-image"
{{ if .Params.featured_image }}
2023-07-01 03:16:59 +00:00
{{ with .Resources.GetMatch .Params.featured_image }}
{{ if eq .MediaType.SubType "svg" }}
style="background-image: url({{ .RelPermalink }})"
{{ else }}
{{ with .Resize "1500x webp" }}
style="background-image: url({{ .RelPermalink }})"
{{ end }}
{{ end }}
2022-11-11 05:48:02 +00:00
{{ else }}
style="background-image: url({{ .Params.featured_image }})"
{{ end }}
2023-07-01 03:16:59 +00:00
{{ end -}}
>
<div class=" article-header__title-wrapper">
<p class="p-name" style="display: none;" itemprop="name"><a class="u-url u-uid" href="{{ .Permalink }}">{{ .Title | safeHTML }}{{ with .Params.subtitle }}: {{ . | safeHTML }}{{ end }}</a></p>
<h2 class="article-header__title{{ if gt ( len ( .Title | plainify ) ) 40 }} article-header__title--long{{ end }}">
{{- .Title | safeHTML -}}
</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">
{{ if .Params.attrlink }}<a href="{{ .Params.attrlink }}" target="_blank" rel="noopener">{{ end }}
{{- .Params.Attr | safeHTML -}}
{{ if .Params.attrlink }}</a>{{ end }}
{{ if .Params.attrlicence }} ({{ .Params.attrlicence }}){{ end }}
<p>
{{ end }}
</div>
<p class="article-header__word-count">~<span itemprop="wordCount">{{ .FuzzyWordCount | lang.NumFmt 0 }}</span> words</p>
2023-07-01 03:16:59 +00:00
<p class="article-header__publish-date">Published: <time class="dt-published" datetime="{{ .PublishDate | time.Format "2006-01-02T15:04:05-07:00" }}" itemprop="datePublished">{{ .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.NumFmt 0 }}&nbsp;<abbr style="font-variant: small-caps; font-size: 0.8em;" title="Holocene Era">HE</abbr></time></p>
<p class="article-header__modified-date">Last modified: <time class="dt-updated" datetime="{{ .Lastmod | time.Format "2006-01-02T15:04:05-07:00" }}" itemprop="dateModified">{{ .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.NumFmt 0 }}&nbsp;<abbr style="font-variant: small-caps; font-size: 0.8em;" title="Holocene Era">HE</abbr></time></p>
<p style="display: none">Author{{ with .Params.authors }}s{{ end }}:&nbsp;
{{- with .Params.authors -}}
</p>
<ul>
{{- range . -}}
{{- if ( eq . .Site.Author.name ) -}}
<li><p><a class="p-author" itemprop="author" rel="author" href="{{ .Site.Home.Permalink }}">{{ .Site.Author.name }}</a></p></li>
{{- else -}}
<li><p class="p-author" itemprop="author">{{- . -}}</p></li>
{{- end -}}
{{- end -}}
</ul>
{{- else -}}
<a class="p-author" itemprop="author" rel="author" href="{{ .Site.Home.Permalink }}">{{ .Site.Author.name }}</a>
{{- end -}}
</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 }}
2023-07-01 03:16:59 +00:00
{{- if fileExists ( path.Join $.Page.File.Dir "appendices.md" ) -}}
<ul class="toc-list--appendices">
<li><a href="#appendices">Appendices</a>
<ol>
{{ range .Params.appendices }}
<li><a href="#{{ . | anchorize }}">{{ . | safeHTML }}</a></li>
{{ end }}
</ol>
</li>
</ul>
{{- end -}}
2023-08-07 22:23:46 +00:00
{{- if fileExists ( path.Join $.Page.File.Dir "corrigenda.md" ) -}}
<ul class="toc-list--corrigenda">
<li><a href="#corrigenda">Corrigenda</a></li>
</ul>
{{- end -}}
2022-11-11 05:48:02 +00:00
</nav>
{{ end }}
</header>
{{ end }}
{{ define "main-body" }}
2023-07-01 03:16:59 +00:00
<section class="site-content__body" itemprop="articleBody">
{{ with .Summary }}
<section class="article-body__summary" itemprop="abstract">
<h2>Summary</h2>
<p class="p-summary">{{ . }}</p>
</section>
{{ end }}
{{- 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 class="button" href="{{ .link }}">{{ .title | safeHTML }}</a></li>
{{ else }}
<li><a class="button" 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 class="button" href="{{ .link }}">{{ .title | safeHTML }}</a></li>
{{ else }}
<li><a class="button" href="{{ . }}">Link</a></li>
{{ end }}
{{- end -}}
</ul>
{{- end -}}
</section>
{{- end -}}
<section class="e-content article-body__content" itemprop="articleBody">
{{ .Content }}
</section>
{{ if fileExists ( path.Join $.Page.File.Dir "appendices.md" ) }}
<section class="article-body__appendices">
<h2 class="subheading subheading--appendices" id="appendices">Appendices</h2>
{{ $file := path.Join $.Page.File.Dir "appendices.md" | readFile }}
{{ $file | .RenderString }}
</section>
{{ end }}
2023-08-07 22:23:46 +00:00
2023-08-22 10:14:33 +00:00
{{ if fileExists ( path.Join $.Page.File.Dir "corrigendum.md" ) }}
<section class="article-body__corrigendum" itemprop="correction" itemscope itemtype="https://schema.org/CorrectionComment">
2023-08-07 22:23:46 +00:00
<h2 class="subheading subheading--corrigendum" id="corrigendum">Corrigendum</h2>
{{ $file := path.Join $.Page.File.Dir "corrigendum.md" | readFile }}
{{ $file | .RenderString }}
</section>
{{ end }}
2023-07-01 03:16:59 +00:00
</section>
2023-08-22 10:14:33 +00:00
{{ with .Page.Resources.Get "comments.md" }}
<section class="site-content__comments">
<h2 class="subheading subheading--comments" id="comments">Comments</h2>
<ul class="comment__thread">
{{ .RenderShortcodes }}
2023-10-03 12:08:35 +00:00
</ul>
2023-08-22 10:14:33 +00:00
</section>
{{ end }}
2022-11-11 05:48:02 +00:00
{{ end }}
{{ define "main-footer" }}
{{ partial "post-meta.html" . }}
{{ end }}