various updates
This commit is contained in:
parent
4955708f0e
commit
ee87009471
37 changed files with 1734 additions and 401 deletions
|
@ -63,30 +63,30 @@
|
|||
|
||||
{{ define "main-header" }}
|
||||
<header class="site-content__header">
|
||||
<h1 class="page-title">{{ .Title | safeHTML }}
|
||||
<h2 class="page-title">{{ .Title | safeHTML }}
|
||||
{{ if eq .Type "blog" }}
|
||||
{{ with .GetPage "blog/posts" }}
|
||||
{{ range .AlternativeOutputFormats -}}
|
||||
<a href="{{ .RelPermalink }}">
|
||||
<img class="feed-icon" src="{{ $.Site.Params.feedIcon }}">
|
||||
<a href="{{ .RelPermalink }}" aria-label="{{ $.Title }} RSS feed">
|
||||
<img class="feed-icon" alt="RSS icon" src="{{ $.Site.Params.feedIcon }}">
|
||||
</a>
|
||||
{{ end }}
|
||||
{{ end }}
|
||||
{{ else }}
|
||||
{{ range .AlternativeOutputFormats -}}
|
||||
<a href="{{ .RelPermalink }}">
|
||||
<img class="feed-icon" src="{{ $.Site.Params.feedIcon }}">
|
||||
</a>
|
||||
{{ end }}
|
||||
<a href="{{ .RelPermalink }}" aria-label="{{ $.Title }} RSS feed">
|
||||
<img class="feed-icon" alt="RSS icon" src="{{ $.Site.Params.feedIcon }}">
|
||||
</a>
|
||||
{{ end }}
|
||||
{{ end }}
|
||||
</h1>
|
||||
</h2>
|
||||
{{ .Content }}
|
||||
|
||||
<nav class="page-header__minor-links">
|
||||
<ul class="minor-links__categories">
|
||||
<li><a href="/series"><h2>Series’</h2></a> <p>({{ len .Site.Taxonomies.series }})</p></li>
|
||||
<li><a href="/series"><h3>Series’</h3></a> <p>({{ len .Site.Taxonomies.series }})</p></li>
|
||||
{{ range .Site.Taxonomies.categories }}
|
||||
<li><a href="{{ .Page.RelPermalink }}"><h2>{{ .Page.Title | safeHTML }}</h2></a> <p>({{ len . }})</p></li>
|
||||
<li><a href="{{ .Page.RelPermalink }}"><h3>{{ .Page.Title | safeHTML }}</h3></a> <p>({{ len . }})</p></li>
|
||||
{{ end }}
|
||||
</ul>
|
||||
{{ if eq .Type "blog" }}
|
||||
|
|
|
@ -4,55 +4,56 @@
|
|||
|
||||
{{ define "main-class" }}--single{{ end }}
|
||||
|
||||
{{ define "header-scripts" }}
|
||||
{{ with .Params.locations }}
|
||||
{{ $mapJS := resources.Get "js/leaflet.js" | fingerprint }}
|
||||
<script id="Map-script" src="{{ $mapJS.Permalink }}" integrity="{{ $mapJS.Data.Integrity }}"></script>
|
||||
{{ end }}
|
||||
{{ end }}
|
||||
|
||||
{{ define "header-styles" }}
|
||||
{{ 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 }}
|
||||
{{ end }}
|
||||
|
||||
{{ define "footer-scripts" }}
|
||||
{{ with .Params.locations }}
|
||||
<script src="https://www.openlayers.org/api/OpenLayers.js"></script>
|
||||
<script>
|
||||
map = new OpenLayers.Map("mapdiv");
|
||||
map.addLayer(new OpenLayers.Layer.OSM());
|
||||
<script>
|
||||
var map = L.map('map').setView([55, -3], 13);
|
||||
|
||||
var lonLats = [];
|
||||
L.tileLayer('https://tile.openstreetmap.org/{z}/{x}/{y}.png', {
|
||||
maxZoom: 19,
|
||||
attribution: '© <a href="https://www.openstreetmap.org/copyright">OpenStreetMap</a>'
|
||||
}).addTo(map);
|
||||
|
||||
var latLons = [];
|
||||
{{ range . }}
|
||||
{{ with ( index $.Site.Data.locations . ) }}
|
||||
lonLats.push(new OpenLayers.LonLat( {{ .lon }} , {{ .lat }} )
|
||||
.transform(
|
||||
new OpenLayers.Projection("EPSG:4326"), // transform from WGS 1984
|
||||
map.getProjectionObject() // to Spherical Mercator Projection
|
||||
));
|
||||
{{ with ( index $.Site.Data.locations . ) }}
|
||||
L.marker([{{ .lat }}, {{ .lon }}]).addTo(map);
|
||||
latLons.push([{{ .lat }}, {{ .lon }}]);
|
||||
{{ else }}
|
||||
{{ warnf "Could not find lat-lon for %q (%q)" . $.File.Path }}
|
||||
{{ end }}
|
||||
{{ end }}
|
||||
|
||||
/* TODO: Smarter zoom selection */
|
||||
var zoom=5;
|
||||
|
||||
var markers = new OpenLayers.Layer.Markers( "Markers" );
|
||||
map.addLayer(markers);
|
||||
|
||||
for (var i = 0; i < lonLats.length; i++) {
|
||||
markers.addMarker(new OpenLayers.Marker(lonLats[i]));
|
||||
}
|
||||
|
||||
/* TODO: Smarter centering */
|
||||
map.setCenter(lonLats[0], zoom);
|
||||
map.fitBounds(latLons);
|
||||
</script>
|
||||
{{ end }}
|
||||
{{ with .Params.scripts }}
|
||||
{{ if in . "mathjax" }}
|
||||
<script src="https://polyfill.io/v3/polyfill.min.js?features=es6"></script>
|
||||
<script id="MathJax-script" async src="https://cdn.jsdelivr.net/npm/mathjax@3/es5/tex-mml-chtml.js"></script>
|
||||
<script src="/js/mathjax-config.js"></script>
|
||||
{{ $mathJaxCoreJS := resources.Get "js/mathjax.js" | fingerprint }}
|
||||
{{ $mathJaxConfigJS := resources.Get "js/mathjax-config.js" | js.Build | fingerprint }}
|
||||
<script id="MathJax-script" async src="{{ $mathJaxCoreJS.Permalink }}" integrity="{{ $mathJaxCoreJS.Data.Integrity }}"></script>
|
||||
<script id="MathJax-config-script" async src="{{ $mathJaxConfigJS.Permalink }}" integrity="{{ $mathJaxConfigJS.Data.Integrity }}"></script>
|
||||
{{ end }}
|
||||
{{ if in . "charts" }}
|
||||
<script src="https://cdn.jsdelivr.net/npm/chart.js"></script>
|
||||
<script src="{{ ( $.Page.Resources.GetMatch "charts-init").RelPermalink }}"></script>
|
||||
{{ $chartsCoreJS := resources.Get "js/chart.js" | fingerprint }}
|
||||
{{ $chartsConfigJS := $.Page.Resources.GetMatch "charts-init" }}
|
||||
<script id="Charts-script" src="{{ $chartsCoreJS.Permalink }}" integrity="{{ $chartsCoreJS.Data.Integrity }}"></script>
|
||||
<script id="Charts-config-script" src="{{ $chartsConfigJS.Permalink }}"></script>
|
||||
{{ end }}
|
||||
{{ end }}
|
||||
{{ end }}
|
||||
|
@ -62,25 +63,53 @@
|
|||
{{ if .Params.series }}
|
||||
<p class="article-header__series">Part of series:
|
||||
{{ range ( .GetTerms "series" ) }}
|
||||
<a href="{{ .RelPermalink }}">{{ .LinkTitle }}</a>
|
||||
<a class="u-url" href="{{ .RelPermalink }}">{{ .LinkTitle }}</a>
|
||||
{{ end }}
|
||||
</p>
|
||||
{{ end }}
|
||||
{{ 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 }}
|
||||
<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 }})"
|
||||
{{ 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 }}
|
||||
{{ else }}
|
||||
style="background-image: url({{ .Params.featured_image }})"
|
||||
{{ end }}
|
||||
{{ end }}>
|
||||
<div class="article-header__title-wrapper">
|
||||
<h1 class="article-header__title{{ if gt ( len ( .Title | plainify ) ) 40 }} article-header__title--long{{ end }}">
|
||||
<span role="text" itemprop="name">{{ .Title | safeHTML }}</span>
|
||||
</h1>
|
||||
{{ with .Params.subtitle }}
|
||||
<p class="article-header__subtitle">{{ . | safeHTML }}</p>
|
||||
{{ end }}
|
||||
{{ 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 }}
|
||||
</div>
|
||||
{{ with .Resources.GetMatch .Params.featured_image }}
|
||||
<p class="attr">
|
||||
|
@ -93,8 +122,27 @@
|
|||
</div>
|
||||
|
||||
<p class="article-header__word-count">~<span itemprop="wordCount">{{ .FuzzyWordCount | lang.NumFmt 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.NumFmt 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.NumFmt 0 }} <abbr style="text-transform: small-caps; font-size: 0.8em;" title="Holocene Era">HE</abbr></span></p>
|
||||
|
||||
<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 }} <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 }} <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 }}:
|
||||
{{- 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>
|
||||
|
||||
{{ $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 ) ) }}
|
||||
|
@ -119,25 +167,76 @@
|
|||
|
||||
{{ if and ( .TableOfContents ) ( ne .TableOfContents "<nav id=\"TableOfContents\"></nav>" ) }}
|
||||
<nav class="article-header__table-of-contents">
|
||||
<h2 class="article-header__subtitle">Table of Contents</h2>
|
||||
<h3 class="article-header__subtitle">Table of Contents</h3>
|
||||
{{ .TableOfContents }}
|
||||
{{- 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 -}}
|
||||
</nav>
|
||||
{{ end }}
|
||||
</header>
|
||||
{{ end }}
|
||||
|
||||
{{ define "main-body" }}
|
||||
<article class="site-content__body" itemprop="articleBody">
|
||||
{{ .Content }}
|
||||
{{ if fileExists ( path.Join $.Page.File.Dir "appendices.md" ) }}
|
||||
<section class="article-body__appendices">
|
||||
<h2 class="subheading subheading--appendices">Appendices</h2>
|
||||
{{ warnf "Getting appendix for '%v'" $.File.Dir }}
|
||||
{{ $file := path.Join $.Page.File.Dir "appendices.md" }}
|
||||
{{ $file | markdownify }}
|
||||
</section>
|
||||
{{ end }}
|
||||
</article>
|
||||
<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 }}
|
||||
</section>
|
||||
{{ end }}
|
||||
|
||||
{{ define "main-footer" }}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue