refactor: split single header and meta components into partials
This commit is contained in:
parent
d0577aec91
commit
e6889cabba
22 changed files with 742 additions and 406 deletions
|
@ -6,21 +6,31 @@
|
|||
|
||||
{{ define "header-scripts" }}
|
||||
{{ with .Params.locations }}
|
||||
<script id="Map-script" src="/js/leaflet/leaflet.js"></script>
|
||||
<script
|
||||
id="Map-script"
|
||||
src="/js/leaflet/leaflet.js"
|
||||
></script>
|
||||
{{ end }}
|
||||
{{ end }}
|
||||
|
||||
{{ define "header-styles" }}
|
||||
{{ with .Params.styles }}
|
||||
<link rel="stylesheet" type="text/css" href="{{ ( $.Page.Resources.GetMatch "style").RelPermalink }}">
|
||||
<link
|
||||
rel="stylesheet"
|
||||
type="text/css"
|
||||
href="{{ ( $.Page.Resources.GetMatch "style").RelPermalink }}"
|
||||
/>
|
||||
{{ end }}
|
||||
{{ with .Params.locations }}
|
||||
<link rel="stylesheet" href="/css/leaflet/leaflet.css">
|
||||
<link
|
||||
rel="stylesheet"
|
||||
href="/css/leaflet/leaflet.css"
|
||||
/>
|
||||
{{ end }}
|
||||
{{ end }}
|
||||
|
||||
{{ define "footer-scripts" }}
|
||||
{{ with .Params.locations }}
|
||||
{{ with .Params.locations }}
|
||||
<script>
|
||||
var map = L.map('map').setView([55, -3], 13);
|
||||
|
||||
|
@ -42,85 +52,25 @@
|
|||
|
||||
map.fitBounds(latLons);
|
||||
</script>
|
||||
{{ end }}
|
||||
{{ with .Params.scripts }}
|
||||
{{ if in . "charts" }}
|
||||
{{ $chartsConfigJS := $.Page.Resources.GetMatch "charts-init" | fingerprint }}
|
||||
<script id="Charts-script" src="/js/chart/chart.js"></script>
|
||||
<script id="Charts-config-script" src="{{ $chartsConfigJS.Permalink }}" integrity="{{ $chartsConfigJS.Data.Integrity }}"></script>
|
||||
{{ end }}
|
||||
{{ end }}
|
||||
{{ end }}
|
||||
{{ with .Params.scripts }}
|
||||
{{ if in . "charts" }}
|
||||
{{ $chartsConfigJS := $.Page.Resources.GetMatch "charts-init" | fingerprint }}
|
||||
<script
|
||||
id="Charts-script"
|
||||
src="/js/chart/chart.js"
|
||||
></script>
|
||||
<script
|
||||
id="Charts-config-script"
|
||||
src="{{ $chartsConfigJS.Permalink }}"
|
||||
integrity="{{ $chartsConfigJS.Data.Integrity }}"
|
||||
></script>
|
||||
{{ 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">
|
||||
<h2 class="article-header__title{{ if gt ( len ( .Title | plainify ) ) 40 }} article-header__title--long{{ end }}">
|
||||
<span role="text" itemprop="name">{{ .Title | safeHTML }}</span>
|
||||
</h2>
|
||||
{{ with .Params.subtitle }}
|
||||
<p class="article-header__subtitle">{{ . | safeHTML }}</p>
|
||||
{{ end }}
|
||||
</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 }} (
|
||||
{{- with .Params.attrlicencelink -}}
|
||||
<a href="{{ . }}" target="_blank" rel="noopener">
|
||||
{{- end -}}
|
||||
{{- .Params.attrlicence -}}
|
||||
{{- with .Params.attrlicencelink -}}
|
||||
</a>
|
||||
{{- end -}}
|
||||
)
|
||||
{{- end -}}
|
||||
</p>
|
||||
{{ end }}
|
||||
</div>
|
||||
|
||||
<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>
|
||||
|
||||
{{ $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">
|
||||
<h3 class="article-header__subtitle">Table of Contents</h3>
|
||||
{{ .TableOfContents }}
|
||||
</nav>
|
||||
{{ end }}
|
||||
</header>
|
||||
{{ partial "single/main-header.html" ( dict "pc" . "sc" $ ) }}
|
||||
{{ end }}
|
||||
|
||||
{{ define "main-body" }}
|
||||
|
@ -128,29 +78,43 @@
|
|||
{{- 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>
|
||||
<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>
|
||||
<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 -}}
|
||||
|
@ -160,5 +124,5 @@
|
|||
{{ end }}
|
||||
|
||||
{{ define "main-footer" }}
|
||||
{{ partial "post-meta.html" . }}
|
||||
{{ partial "single/post-meta.html" ( dict "pc" . "sc" $ ) }}
|
||||
{{ end }}
|
||||
|
|
|
@ -1,26 +1,37 @@
|
|||
{{ define "title" }}
|
||||
“{{ .Title | plainify }}” | {{ .Site.Title }}
|
||||
“{{ .Title | plainify }}” |
|
||||
{{ .Site.Title }}
|
||||
{{ end }}
|
||||
|
||||
{{ define "main-class" }}--single layouts-blog-single{{ end }}
|
||||
|
||||
{{ define "header-scripts" }}
|
||||
{{ with .Params.locations }}
|
||||
<script id="Map-script" src="/js/leaflet/leaflet.js"></script>
|
||||
{{ end }}
|
||||
{{ with .Params.locations }}
|
||||
<script
|
||||
id="Map-script"
|
||||
src="/js/leaflet/leaflet.js"
|
||||
></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/leaflet.css">
|
||||
{{ end }}
|
||||
{{ 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/leaflet.css"
|
||||
/>
|
||||
{{ end }}
|
||||
{{ end }}
|
||||
|
||||
{{ define "footer-scripts" }}
|
||||
{{ with .Params.locations }}
|
||||
{{ with .Params.locations }}
|
||||
<script>
|
||||
var map = L.map('map').setView([55, -3], 13);
|
||||
|
||||
|
@ -43,226 +54,125 @@
|
|||
map.fitBounds(latLons);
|
||||
if (map.getZoom() < 10) map.setZoom(10);
|
||||
</script>
|
||||
{{ end }}
|
||||
{{ if $.HasShortcode "chart" }}
|
||||
{{ $chartsConfigJS := $.Page.Resources.GetMatch "charts-init" | fingerprint }}
|
||||
<script id="Charts-script" src="/js/chart/chart.js"></script>
|
||||
<script id="Charts-config-script" src="{{ $chartsConfigJS.Permalink }}" integrity="{{ $chartsConfigJS.Data.Integrity }}"></script>
|
||||
{{ end }}
|
||||
{{ end }}
|
||||
{{ if $.HasShortcode "chart" }}
|
||||
{{ $chartsConfigJS := $.Page.Resources.GetMatch "charts-init" | fingerprint }}
|
||||
<script
|
||||
id="Charts-script"
|
||||
src="/js/chart/chart.js"
|
||||
></script>
|
||||
<script
|
||||
id="Charts-config-script"
|
||||
src="{{ $chartsConfigJS.Permalink }}"
|
||||
integrity="{{ $chartsConfigJS.Data.Integrity }}"
|
||||
></script>
|
||||
{{ end }}
|
||||
{{ end }}
|
||||
|
||||
{{ define "main-header" }}
|
||||
<header class="site-content__header">
|
||||
{{ if .Params.series }}
|
||||
<p class="article-header__series">Part of series:
|
||||
{{ range ( .GetTerms "series" ) }}
|
||||
<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 }}
|
||||
{{ 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">
|
||||
<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">
|
||||
{{- 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 -}}
|
||||
<p>
|
||||
{{ end }}
|
||||
</div>
|
||||
|
||||
<p class="article-header__word-count">~<span itemprop="wordCount">{{ .FuzzyWordCount | lang.FormatNumberCustom 0 }}</span> words</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.FormatNumberCustom 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.FormatNumberCustom 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.Params.Author.name ) -}}
|
||||
<li><p><a class="p-author" itemprop="author" rel="author" href="{{ .Site.Home.Permalink }}">{{ .Site.Params.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.Params.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 ) ) }}
|
||||
<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>{{ . | $.RenderString | safeHTML }}</li>
|
||||
{{ end }}
|
||||
</ul>
|
||||
</aside>
|
||||
{{ end }}
|
||||
|
||||
{{ if and ( .TableOfContents ) ( ne .TableOfContents "<nav id=\"TableOfContents\"></nav>" ) }}
|
||||
<nav class="article-header__table-of-contents">
|
||||
<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 -}}
|
||||
{{- if fileExists ( path.Join $.Page.File.Dir "corrigenda.md" ) -}}
|
||||
<ul class="toc-list--corrigenda">
|
||||
<li><a href="#corrigenda">Corrigenda</a></li>
|
||||
</ul>
|
||||
{{- end -}}
|
||||
</nav>
|
||||
{{ end }}
|
||||
</header>
|
||||
{{ partial "single/main-header.html" ( dict "pc" . "sc" $ ) }}
|
||||
{{ end }}
|
||||
|
||||
{{ define "main-body" }}
|
||||
<section class="site-content__body" itemprop="articleBody">
|
||||
<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 }}
|
||||
|
||||
{{ 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 href="{{ .link }}">{{ .title | safeHTML }}</a></li>
|
||||
{{ else }}
|
||||
<li><a href="{{ . }}">Link</a></li>
|
||||
{{ end }}
|
||||
{{- end -}}
|
||||
</ul>
|
||||
{{- 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 href="{{ .link }}">{{ .title | safeHTML }}</a></li>
|
||||
{{ else }}
|
||||
<li><a href="{{ . }}">Link</a></li>
|
||||
{{ end }}
|
||||
{{- end -}}
|
||||
</ul>
|
||||
{{- with .Params.external_links -}}
|
||||
<h3>External 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 -}}
|
||||
</section>
|
||||
{{- end -}}
|
||||
|
||||
{{- with .Params.external_links -}}
|
||||
<h3>External 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 -}}
|
||||
</section>
|
||||
{{- end -}}
|
||||
|
||||
<section class="e-content article-body__content" itemprop="articleBody">
|
||||
<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 }}
|
||||
{{ 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 }}
|
||||
|
||||
{{ if fileExists ( path.Join $.Page.File.Dir "corrigendum.md" ) }}
|
||||
<section class="article-body__corrigendum" itemprop="correction" itemscope itemtype="https://schema.org/CorrectionComment">
|
||||
<h2 class="subheading subheading--corrigendum" id="corrigendum">Corrigendum</h2>
|
||||
{{ $file := path.Join $.Page.File.Dir "corrigendum.md" | readFile }}
|
||||
{{ $file | .RenderString }}
|
||||
</section>
|
||||
{{ end }}
|
||||
{{ if fileExists ( path.Join $.Page.File.Dir "corrigendum.md" ) }}
|
||||
<section
|
||||
class="article-body__corrigendum"
|
||||
itemprop="correction"
|
||||
itemscope
|
||||
itemtype="https://schema.org/CorrectionComment"
|
||||
>
|
||||
<h2
|
||||
class="subheading subheading--corrigendum"
|
||||
id="corrigendum"
|
||||
>
|
||||
Corrigendum
|
||||
</h2>
|
||||
{{ $file := path.Join $.Page.File.Dir "corrigendum.md" | readFile }}
|
||||
{{ $file | .RenderString }}
|
||||
</section>
|
||||
{{ end }}
|
||||
</section>
|
||||
|
||||
{{ with .Page.Resources.Get "comments.md" }}
|
||||
<section class="site-content__comments">
|
||||
<h2 class="subheading subheading--comments" id="comments">Comments</h2>
|
||||
<h2
|
||||
class="subheading subheading--comments"
|
||||
id="comments"
|
||||
>
|
||||
Comments
|
||||
</h2>
|
||||
<ul class="comment__thread">
|
||||
{{ .RenderShortcodes }}
|
||||
{{ .RenderShortcodes }}
|
||||
</ul>
|
||||
</section>
|
||||
{{ end }}
|
||||
{{ end }}
|
||||
|
||||
{{ define "main-footer" }}
|
||||
{{ partial "post-meta.html" . }}
|
||||
{{ partial "single/post-meta.html" ( dict "pc" . "sc" $ ) }}
|
||||
{{ end }}
|
||||
|
|
30
layouts/partials/cv/organisation/get-title.html
Normal file
30
layouts/partials/cv/organisation/get-title.html
Normal file
|
@ -0,0 +1,30 @@
|
|||
{{- /*
|
||||
Displays an organisation's title.
|
||||
|
||||
@params organisation The organisation to display.
|
||||
@params site_redact The site-level redaction display settings.
|
||||
*/
|
||||
-}}
|
||||
|
||||
{{ $is_redacted := .organisation.Params.redact }}
|
||||
{{ $is_site_show_redacted := eq .site_redact "show" }}
|
||||
{{ $is_site_black_redacted := eq .site_redact "black" }}
|
||||
{{ $is_hidden := and $is_redacted ( not $is_site_show_redacted ) }}
|
||||
|
||||
{{- if $is_hidden -}}
|
||||
{{- if $is_site_black_redacted -}}
|
||||
<li>{{- partialCached "redact-black.html" . -}}</li>
|
||||
{{- end -}}
|
||||
{{- else -}}
|
||||
<li>
|
||||
<a href="{{ .organisation.RelPermalink }}"
|
||||
>{{ if ( .organisation.Params.markup_title ) }}
|
||||
{{ .organisation.Params.markup_title | safeHTML }}
|
||||
{{ else if ( .organisation.Params.titleLang ) }}
|
||||
{{ partial "text/foreign-text.html" ( dict "original" .organisation.Title "lang" .organisation.Params.titleLang "translation" .organisation.Params.titleTrans ) }}
|
||||
{{ else }}
|
||||
{{ .organisation.Title }}
|
||||
{{ end }}</a
|
||||
>
|
||||
</li>
|
||||
{{- end -}}
|
25
layouts/partials/images/get-image.html
Normal file
25
layouts/partials/images/get-image.html
Normal file
|
@ -0,0 +1,25 @@
|
|||
{{- /*
|
||||
Renders an image, resizing it if valid.
|
||||
|
||||
@params img The image.
|
||||
*/
|
||||
-}}
|
||||
|
||||
|
||||
<!-- Validation -->
|
||||
|
||||
{{- if ne .img.MediaType.MainType "image" -}}
|
||||
{{- errorf "Image '%q' is not an image" .img }}
|
||||
{{- end -}}
|
||||
|
||||
|
||||
<!-- Rendering -->
|
||||
|
||||
{{- $isResizable := in ( slice "avif" "svg" "gif" ) .MediaType.SubType -}}
|
||||
{{- if $isResizable -}}
|
||||
{{- with .Resize "1200x webp" -}}
|
||||
{{- .RelPermalink -}}
|
||||
{{- end -}}
|
||||
{{- else }}
|
||||
{{- .RelPermalink -}}
|
||||
{{- end -}}
|
|
@ -1,91 +0,0 @@
|
|||
<footer class="site-content__footer">
|
||||
<h2>Meta</h2>
|
||||
|
||||
{{- if .GetTerms "categories" -}}
|
||||
<section id="post-categories" class="article-footer__categories" aria-labelledby="post-categories-title" itemprop="articleSection">
|
||||
<h3 id="post-categories-title">Categories</h3>
|
||||
<ul>
|
||||
{{- range (.GetTerms "categories") -}}
|
||||
<li class="p-category"><a href="{{ .RelPermalink }}">{{ .LinkTitle | safeHTML }}</a></li>
|
||||
{{- end -}}
|
||||
</ul>
|
||||
</section>
|
||||
{{- end -}}
|
||||
|
||||
{{- if .GetTerms "areas" -}}
|
||||
<section class="article-footer__links" itemprop="articleSection">
|
||||
<h3 id="item-areas-title">Areas</h3>
|
||||
<ul>
|
||||
{{- range ( .GetTerms "areas" ).ByTitle -}}
|
||||
<li class="p-category"><a href="{{ .RelPermalink }}">{{ .LinkTitle }}</a></li>
|
||||
{{- end -}}
|
||||
</ul>
|
||||
</section>
|
||||
{{- end -}}
|
||||
|
||||
{{- if .GetTerms "skills" -}}
|
||||
<section class="article-footer__links" itemprop="articleSection">
|
||||
<h3 id="item-skills-title">Skills</h3>
|
||||
<ul>
|
||||
{{- .Scratch.Set "i" 0 -}}
|
||||
{{- range ( .GetTerms "skills" ).ByTitle -}}
|
||||
{{- if hasPrefix .LinkTitle "CIISec/" -}}
|
||||
<li class="p-category"><a href="{{ .RelPermalink }}">{{ .LinkTitle }}</a> <span class="level">(level {{ index $.Params.skills_ciisec_levels ( $.Scratch.Get "i" ) }})</span></li>
|
||||
{{- $.Scratch.Add "i" 1 -}}
|
||||
{{- else -}}
|
||||
<li class="p-category"><a href="{{ .RelPermalink }}">{{ .LinkTitle }}</a></li>
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
</ul>
|
||||
</section>
|
||||
{{- end -}}
|
||||
|
||||
{{- if .GetTerms "organisations" -}}
|
||||
<section id="post-organisations" class="article-footer__organisations" itemprop="articleSection">
|
||||
<h3>Organisations</h3>
|
||||
<ul>
|
||||
{{ $all_organisations := partialCached "get_all_organisations.html" . }}
|
||||
<!-- TODO: Replace with hierarchy partial -->
|
||||
{{- range ( .GetTerms "organisations" ) -}}
|
||||
{{ with ( union ( union ( where $all_organisations "Title" ( .Title | plainify ) ) ( where $all_organisations "Params.abbreviation" ( .Title | plainify ) ) ) ( where $all_organisations "Params.fka" ( .Title | plainify ) ) ) }}
|
||||
{{ range . }}
|
||||
{{- if ( and ( .Params.redact ) ( ne $.Site.Params.redact "show" ) ) -}}
|
||||
{{- if ( eq $.Site.Params.redact "black" ) -}}
|
||||
<li>{{- partialCached "redact-black.html" . -}}</li>
|
||||
{{- end -}}
|
||||
{{- else -}}
|
||||
<li><a href="{{ .RelPermalink }}">{{ if ( .Params.markup_title ) }}{{ .Params.markup_title | safeHTML }}{{ else }}{{ .Title }}{{ end }}</a></li>
|
||||
{{- end -}}
|
||||
{{ end }}
|
||||
{{ else }}
|
||||
{{ erroridf "missing-organisation" "Could not find organisation %q (%q)" .Title $.File.Path }}
|
||||
<li>{{ if ( .Params.markup_title ) }}{{ .Params.markup_title | safeHTML }}{{ else }}{{ .Title }}{{ end }}</li>
|
||||
{{ end }}
|
||||
{{- end -}}
|
||||
</ul>
|
||||
</section>
|
||||
{{- end -}}
|
||||
|
||||
{{- if .GetTerms "locations" -}}
|
||||
<section id="post-locations" class="article-footer__locations">
|
||||
<h3>Locations</h3>
|
||||
<div id="map" style="width: 100%; height: 500px; margin: 0; display: block;"></div>
|
||||
<ul style="display: none">
|
||||
{{- range ( .GetTerms "locations" ).ByTitle -}}
|
||||
<li class="p-location"><a href="{{ .RelPermalink }}">{{ .LinkTitle | safeHTML }}</a></li>
|
||||
{{- end -}}
|
||||
</ul>
|
||||
</section>
|
||||
{{- end -}}
|
||||
|
||||
{{- if .GetTerms "tags" -}}
|
||||
<section id="post-tags" class="article-footer__tags">
|
||||
<h3>Tags</h3>
|
||||
<ul>
|
||||
{{- range ( .GetTerms "tags" ).ByTitle -}}
|
||||
<li class="p-category"><a href="{{ .RelPermalink }}">{{ .LinkTitle | safeHTML }}</a></li>
|
||||
{{- end -}}
|
||||
</ul>
|
||||
</section>
|
||||
{{- end -}}
|
||||
</footer>
|
43
layouts/partials/single/main-header.html
Normal file
43
layouts/partials/single/main-header.html
Normal file
|
@ -0,0 +1,43 @@
|
|||
{{- /*
|
||||
Displays the header information for an item.
|
||||
|
||||
@params pc Page context
|
||||
@params sc Site context
|
||||
*/
|
||||
-}}
|
||||
|
||||
|
||||
<!-- Validation -->
|
||||
|
||||
{{- if ( not ( isset . "sc" ) ) -}}
|
||||
{{- errorf "No site context received" -}}
|
||||
{{- end -}}
|
||||
|
||||
{{- if ( not ( isset . "pc" ) ) -}}
|
||||
{{- errorf "No page context received (%q)" .sc.Page.File.Dir -}}
|
||||
{{- end -}}
|
||||
|
||||
|
||||
<!-- Rendering -->
|
||||
|
||||
<header class="site-content__header">
|
||||
{{ if .pc.Params.series }}
|
||||
{{ partial "single/main-header/series.html" ( dict "series" ( .pc.GetTerms "series" ) ) }}
|
||||
{{ end }}
|
||||
|
||||
{{ partial "single/main-header/item-tile.html" ( dict "pc" .pc "sc" .sc ) }}
|
||||
|
||||
{{ partial "single/main-header/word-count.html" ( dict "wordCount" .pc.FuzzyWordCount ) }}
|
||||
|
||||
{{ partial "single/main-header/dates.html" ( dict "publishDate" .pc.PublishDate "lastmodDate" .pc.Lastmod ) }}
|
||||
|
||||
{{ partial "single/main-header/authors.html" ( dict "authors" .pc.Params.authors "site_author" .sc.Site.Params.Author ) }}
|
||||
|
||||
{{ partial "single/main-header/warnings.html" ( dict "pc" .pc ) }}
|
||||
|
||||
{{ with .pc.Params.notes }}
|
||||
{{ partial "single/main-header/notes.html" ( dict "notes" . "sc" $.sc ) }}
|
||||
{{ end }}
|
||||
|
||||
{{ partial "single/main-header/toc.html" ( dict "toc" .pc.TableOfContents "fileDir" .sc.Page.File.Dir "appendices" .pc.Params.appendices ) }}
|
||||
</header>
|
23
layouts/partials/single/main-header/authors.html
Normal file
23
layouts/partials/single/main-header/authors.html
Normal file
|
@ -0,0 +1,23 @@
|
|||
{{- /*
|
||||
Renders the authors for an item.
|
||||
|
||||
@params authors The item's author(s).
|
||||
@params sc The site context.
|
||||
*/ -}}
|
||||
|
||||
<p style="display: none">Author{{ with .authors }}s{{ end }}:
|
||||
{{- with .authors -}}
|
||||
</p>
|
||||
<ul>
|
||||
{{- range . -}}
|
||||
{{- if ( eq . $.site_author.name ) -}}
|
||||
<li><p><a class="p-author" itemprop="author" rel="author" href="{{ $.sc.Site.Home.Permalink }}">{{ $.sc.Site.Params.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="{{ $.sc.Site.Home.Permalink }}">{{ $.sc.Site.Params.Author.name }}</a>
|
||||
{{- end -}}
|
||||
</p>
|
58
layouts/partials/single/main-header/dates.html
Normal file
58
layouts/partials/single/main-header/dates.html
Normal file
|
@ -0,0 +1,58 @@
|
|||
{{- /*
|
||||
Displays dates for an item.
|
||||
|
||||
@params publishDate The date an item was published.
|
||||
@params lastmodDate The date an item was last modified.
|
||||
*/
|
||||
-}}
|
||||
|
||||
{{ $publishDate := .publishDate }}
|
||||
{{ $lastmodDate := .lastmodDate }}
|
||||
|
||||
|
||||
<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.FormatNumberCustom 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="{{ $lastmodDate | time.Format "2006-01-02T15:04:05-07:00" }}"
|
||||
itemprop="dateModified"
|
||||
>{{- $lastmodDate.Format "January 2" -}}<sup>{{- if in (slice 1 21 31) $lastmodDate.Day -}}
|
||||
st
|
||||
{{- else if in (slice 2 22) $lastmodDate.Day -}}
|
||||
nd
|
||||
{{- else if in (slice 3 23) $lastmodDate.Day -}}
|
||||
rd
|
||||
{{- else -}}
|
||||
th
|
||||
{{- end -}}</sup>,
|
||||
1{{- $lastmodDate.Format "2006" | lang.FormatNumberCustom 0 }} <abbr
|
||||
style="font-variant: small-caps; font-size: 0.8em;"
|
||||
title="Holocene Era"
|
||||
>HE</abbr
|
||||
></time
|
||||
>
|
||||
</p>
|
70
layouts/partials/single/main-header/item-tile.html
Normal file
70
layouts/partials/single/main-header/item-tile.html
Normal file
|
@ -0,0 +1,70 @@
|
|||
{{- /*
|
||||
Renders the header tile for an item.
|
||||
|
||||
@params pc The page context.
|
||||
@params sc The site context.
|
||||
*/ -}}
|
||||
|
||||
{{- if ( not ( isset . "sc" ) ) -}}
|
||||
{{- errorf "No site context received" -}}
|
||||
{{- end -}}
|
||||
|
||||
{{- if ( not ( isset . "pc" ) ) -}}
|
||||
{{- errorf "No page context received (%q)" .sc.Page.File.Dir -}}
|
||||
{{- end -}}
|
||||
|
||||
{{ with .pc.Params.featured_image }}
|
||||
<img class="u-photo" style="display: none;" src="
|
||||
{{- with ( $.pc.Resources.GetMatch . ) -}}
|
||||
{{ partialCached "images/get-image.html" ( dict "img" . ) . }}
|
||||
{{- else -}}
|
||||
{{- . -}}
|
||||
{{- end -}}
|
||||
"
|
||||
itemprop="image"
|
||||
{{- with ( $.pc.Resources.GetMatch . ) -}}
|
||||
alt="{{ .Params.alt }}"
|
||||
{{- end -}}
|
||||
/>
|
||||
{{ end }}
|
||||
|
||||
<div class="article-header__featured-image"
|
||||
{{ with .pc.Params.featured_image }}
|
||||
{{ with ( $.pc.Resources.GetMatch . ) }}
|
||||
style="background-image: url({{ partialCached "images/get-image.html" ( dict "img" . ) . }})"
|
||||
{{ else }}
|
||||
style="background-image: url({{ . }})"
|
||||
{{ end }}
|
||||
{{ end -}}
|
||||
>
|
||||
|
||||
<div class="article-header__title-wrapper">
|
||||
<a class="u-url u-uid" style="display: none" href="{{ .pc.Permalink }}"></a>
|
||||
<hgroup class="p-name" itemprop="name">
|
||||
<h2 class="article-header__title{{ if gt ( len ( .pc.Title | plainify ) ) 40 }} article-header__title--long{{ end }}">
|
||||
{{- .pc.Title | safeHTML -}}
|
||||
</h2>
|
||||
{{ with .pc.Params.subtitle }}
|
||||
<p class="article-header__subtitle">{{ . | safeHTML }}</p>
|
||||
{{ end }}
|
||||
</hgroup>
|
||||
</div>
|
||||
|
||||
{{ with ( .pc.Resources.GetMatch .pc.Params.featured_image ) }}
|
||||
<p class="attr">
|
||||
{{- with .Params.attrlink -}}<a href="{{ . }}" 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 -}}
|
||||
{{- if .Params.attrlicencelink -}}
|
||||
</a>
|
||||
{{- end -}}
|
||||
)
|
||||
{{- end -}}
|
||||
<p>
|
||||
{{ end }}
|
||||
</div>
|
16
layouts/partials/single/main-header/notes.html
Normal file
16
layouts/partials/single/main-header/notes.html
Normal file
|
@ -0,0 +1,16 @@
|
|||
{{- /*
|
||||
Renders the notes for an item.
|
||||
|
||||
@params note The notes for an item.
|
||||
@params sc Site context.
|
||||
*/
|
||||
-}}
|
||||
|
||||
|
||||
<aside class="article-header__notes">
|
||||
<ul>
|
||||
{{ range .notes }}
|
||||
<li>{{ . | $.sc.RenderString | safeHTML }}</li>
|
||||
{{ end }}
|
||||
</ul>
|
||||
</aside>
|
18
layouts/partials/single/main-header/series.html
Normal file
18
layouts/partials/single/main-header/series.html
Normal file
|
@ -0,0 +1,18 @@
|
|||
{{- /*
|
||||
Renders the series of an item.
|
||||
|
||||
@params series A list of series' for the item.
|
||||
*/
|
||||
-}}
|
||||
|
||||
|
||||
<p class="article-header__series">
|
||||
Part of series:
|
||||
{{ range .series }}
|
||||
<a
|
||||
class="u-url"
|
||||
href="{{ .RelPermalink }}"
|
||||
>{{ .LinkTitle }}</a
|
||||
>
|
||||
{{ end }}
|
||||
</p>
|
34
layouts/partials/single/main-header/toc.html
Normal file
34
layouts/partials/single/main-header/toc.html
Normal file
|
@ -0,0 +1,34 @@
|
|||
{{- /*
|
||||
Renders appendices and corrigenda for an item.
|
||||
|
||||
@params toc The page ToC.
|
||||
@params appendices The item's appendices. Optional.
|
||||
@params fileDir The file folder name.
|
||||
*/
|
||||
-}}
|
||||
|
||||
{{ $empty_toc_html := "<nav id=\"TableOfContents\"></nav>" }}
|
||||
|
||||
{{ if and ( .toc ) ( ne .toc $empty_toc_html ) }}
|
||||
<nav class="article-header__table-of-contents">
|
||||
<h3 class="article-header__subtitle">Table of Contents</h3>
|
||||
{{ .toc }}
|
||||
{{- if fileExists ( path.Join .fileDir "appendices.md" ) -}}
|
||||
<ul class="toc-list--appendices">
|
||||
<li>
|
||||
<a href="#appendices">Appendices</a>
|
||||
<ol>
|
||||
{{ range .appendices }}
|
||||
<li><a href="#{{ . | anchorize }}">{{ . | safeHTML }}</a></li>
|
||||
{{ end }}
|
||||
</ol>
|
||||
</li>
|
||||
</ul>
|
||||
{{- end -}}
|
||||
{{- if fileExists ( path.Join .fileDir "corrigenda.md" ) -}}
|
||||
<ul class="toc-list--corrigenda">
|
||||
<li><a href="#corrigenda">Corrigenda</a></li>
|
||||
</ul>
|
||||
{{- end -}}
|
||||
</nav>
|
||||
{{ end }}
|
33
layouts/partials/single/main-header/warnings.html
Normal file
33
layouts/partials/single/main-header/warnings.html
Normal file
|
@ -0,0 +1,33 @@
|
|||
{{- /*
|
||||
Renders the automatic warnings for an item.
|
||||
|
||||
@params pc The page context.
|
||||
*/
|
||||
-}}
|
||||
|
||||
{{ $post_age_in_years := math.Round ( div ( div ( now.Sub .pc.PublishDate ).Hours 24 ) 365 ) }}
|
||||
|
||||
{{ if ( or .pc.Params.site .pc.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 .pc.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 .pc.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 }}
|
9
layouts/partials/single/main-header/word-count.html
Normal file
9
layouts/partials/single/main-header/word-count.html
Normal file
|
@ -0,0 +1,9 @@
|
|||
{{- /*
|
||||
Displays the length of an item.
|
||||
|
||||
@params wordCount The wordcount of an item.
|
||||
*/
|
||||
-}}
|
||||
|
||||
|
||||
<p class="article-header__word-count">~<span itemprop="wordCount">{{ .wordCount | lang.FormatNumberCustom 0 }}</span> words</p>
|
36
layouts/partials/single/post-meta.html
Normal file
36
layouts/partials/single/post-meta.html
Normal file
|
@ -0,0 +1,36 @@
|
|||
{{- /*
|
||||
Displays the meta information for an item.
|
||||
|
||||
@params pc Page context
|
||||
@params sc Site context
|
||||
*/
|
||||
-}}
|
||||
|
||||
|
||||
<footer class="site-content__footer">
|
||||
<h2>Meta</h2>
|
||||
|
||||
{{- with ( .pc.GetTerms "categories" ) -}}
|
||||
{{ partial "single/post-meta/categories.html" ( dict "categories" . ) }}
|
||||
{{- end -}}
|
||||
|
||||
{{- with ( .pc.GetTerms "areas" ) -}}
|
||||
{{ partial "single/post-meta/life-areas.html" ( dict "areas" . ) }}
|
||||
{{- end -}}
|
||||
|
||||
{{- with ( .pc.GetTerms "skills" ) -}}
|
||||
{{ partial "single/post-meta/skills.html" ( dict "pc" $.pc "skills" . "skills_ciisec_levels" $.pc.Params.skills_ciisec_levels ) }}
|
||||
{{- end -}}
|
||||
|
||||
{{- if ( .pc.GetTerms "organisations" ) -}}
|
||||
{{ partial "single/post-meta/organisations.html" ( dict "pc" .pc "sc" .sc ) }}
|
||||
{{- end -}}
|
||||
|
||||
{{- with ( .pc.GetTerms "locations" ) -}}
|
||||
{{ partial "single/post-meta/locations.html" ( dict "locations" . ) }}
|
||||
{{- end -}}
|
||||
|
||||
{{- with ( .pc.GetTerms "tags" ) -}}
|
||||
{{ partial "single/post-meta/tags.html" ( dict "tags" . ) }}
|
||||
{{- end -}}
|
||||
</footer>
|
21
layouts/partials/single/post-meta/categories.html
Normal file
21
layouts/partials/single/post-meta/categories.html
Normal file
|
@ -0,0 +1,21 @@
|
|||
{{- /*
|
||||
Displays the categories for an item.
|
||||
|
||||
@params categories The item's categories.
|
||||
*/
|
||||
-}}
|
||||
|
||||
|
||||
<section
|
||||
id="post-categories"
|
||||
class="article-footer__categories"
|
||||
aria-labelledby="post-categories-title"
|
||||
itemprop="articleSection"
|
||||
>
|
||||
<h3 id="post-categories-title">Categories</h3>
|
||||
<ul>
|
||||
{{- range .categories -}}
|
||||
<li class="p-category"><a href="{{ .RelPermalink }}">{{ .LinkTitle | safeHTML }}</a></li>
|
||||
{{- end -}}
|
||||
</ul>
|
||||
</section>
|
19
layouts/partials/single/post-meta/life-areas.html
Normal file
19
layouts/partials/single/post-meta/life-areas.html
Normal file
|
@ -0,0 +1,19 @@
|
|||
{{- /*
|
||||
Displays the life areas for an item.
|
||||
|
||||
@params areas The item's life areas.
|
||||
*/
|
||||
-}}
|
||||
|
||||
|
||||
<section
|
||||
class="article-footer__links"
|
||||
itemprop="articleSection"
|
||||
>
|
||||
<h3 id="item-areas-title">Areas</h3>
|
||||
<ul>
|
||||
{{- range .areas.ByTitle -}}
|
||||
<li class="p-category"><a href="{{ .RelPermalink }}">{{ .LinkTitle }}</a></li>
|
||||
{{- end -}}
|
||||
</ul>
|
||||
</section>
|
23
layouts/partials/single/post-meta/locations.html
Normal file
23
layouts/partials/single/post-meta/locations.html
Normal file
|
@ -0,0 +1,23 @@
|
|||
{{- /*
|
||||
Displays the locations for an item.
|
||||
|
||||
@params locations The locations or the item.
|
||||
*/
|
||||
-}}
|
||||
|
||||
|
||||
<section
|
||||
id="post-locations"
|
||||
class="article-footer__locations"
|
||||
>
|
||||
<h3>Locations</h3>
|
||||
<div
|
||||
id="map"
|
||||
style="width: 100%; height: 500px; margin: 0; display: block;"
|
||||
></div>
|
||||
<ul style="display: none">
|
||||
{{- range .locations.ByTitle -}}
|
||||
<li class="p-location"><a href="{{ .RelPermalink }}">{{ .LinkTitle | safeHTML }}</a></li>
|
||||
{{- end -}}
|
||||
</ul>
|
||||
</section>
|
31
layouts/partials/single/post-meta/organisations.html
Normal file
31
layouts/partials/single/post-meta/organisations.html
Normal file
|
@ -0,0 +1,31 @@
|
|||
{{- /*
|
||||
Displays the organisations for an item.
|
||||
|
||||
@params pc The page context.
|
||||
@params sc The site context.
|
||||
*/
|
||||
-}}
|
||||
|
||||
|
||||
<section
|
||||
id="post-organisations"
|
||||
class="article-footer__organisations"
|
||||
itemprop="articleSection"
|
||||
>
|
||||
<h3>Organisations</h3>
|
||||
<ul>
|
||||
{{ $all_organisations := partialCached "get_all_organisations.html" .pc }}
|
||||
<!-- TODO: Replace with hierarchy partial -->
|
||||
{{- range ( .pc.GetTerms "organisations" ) -}}
|
||||
{{ $matched_organisations := ( union ( union ( where $all_organisations "Title" ( .Title | plainify ) ) ( where $all_organisations "Params.abbreviation" ( .Title | plainify ) ) ) ( where $all_organisations "Params.fka" ( .Title | plainify ) ) ) }}
|
||||
{{ with $matched_organisations }}
|
||||
{{ range . }}
|
||||
{{ partial "cv/organisation/get-title.html" ( dict "organisation" . "site_redact" $.sc.Site.Params.redact ) .File.Dir }}
|
||||
{{ end }}
|
||||
{{ else }}
|
||||
{{ erroridf "missing-organisation" "Could not find organisation %q (%q)" .Title $.sc.File.Path }}
|
||||
<li>{{ if ( .Params.markup_title ) }}{{ .Params.markup_title | safeHTML }}{{ else }}{{ .Title }}{{ end }}</li>
|
||||
{{ end }}
|
||||
{{- end -}}
|
||||
</ul>
|
||||
</section>
|
30
layouts/partials/single/post-meta/skills.html
Normal file
30
layouts/partials/single/post-meta/skills.html
Normal file
|
@ -0,0 +1,30 @@
|
|||
{{- /*
|
||||
Displays the skills for an item.
|
||||
|
||||
@params pc The page context.
|
||||
@params skills The item's skills
|
||||
@params skills_ciisec_levels The matched CIISec levels for the skills. Optional.
|
||||
*/
|
||||
-}}
|
||||
|
||||
|
||||
<section
|
||||
class="article-footer__links"
|
||||
itemprop="articleSection"
|
||||
>
|
||||
<h3 id="item-skills-title">Skills</h3>
|
||||
<ul>
|
||||
{{- .pc.Scratch.Set "i" 0 -}}
|
||||
{{- range .skills.ByTitle -}}
|
||||
{{- if hasPrefix .LinkTitle "CIISec/" -}}
|
||||
<li class="p-category">
|
||||
<a href="{{ .RelPermalink }}">{{ .LinkTitle }}</a>
|
||||
<span class="level">(level {{ index $.skills_ciisec_levels ( $.pc.Scratch.Get "i" ) }})</span>
|
||||
</li>
|
||||
{{- $.pc.Scratch.Add "i" 1 -}}
|
||||
{{- else -}}
|
||||
<li class="p-category"><a href="{{ .RelPermalink }}">{{ .LinkTitle }}</a></li>
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
</ul>
|
||||
</section>
|
19
layouts/partials/single/post-meta/tags.html
Normal file
19
layouts/partials/single/post-meta/tags.html
Normal file
|
@ -0,0 +1,19 @@
|
|||
{{- /*
|
||||
Displays the tags for an item.
|
||||
|
||||
@params tags The tags or the item.
|
||||
*/
|
||||
-}}
|
||||
|
||||
|
||||
<section
|
||||
id="post-tags"
|
||||
class="article-footer__tags"
|
||||
>
|
||||
<h3>Tags</h3>
|
||||
<ul>
|
||||
{{- range .tags.ByTitle -}}
|
||||
<li class="p-category"><a href="{{ .RelPermalink }}">{{ .LinkTitle | safeHTML }}</a></li>
|
||||
{{- end -}}
|
||||
</ul>
|
||||
</section>
|
15
layouts/partials/text/foreign-text.html
Normal file
15
layouts/partials/text/foreign-text.html
Normal file
|
@ -0,0 +1,15 @@
|
|||
{{- /*
|
||||
Displays foreign text.
|
||||
|
||||
@params original The text in the original language.
|
||||
@params lang The language code of the original language.
|
||||
@params translation The text in the parent container's language.
|
||||
*/
|
||||
-}}
|
||||
|
||||
|
||||
<i
|
||||
lang="{{ .lang }}"
|
||||
title="{{ .translation }}"
|
||||
>{{ .original }}</i
|
||||
>
|
Loading…
Add table
Reference in a new issue