refactor templates layout
@see https://gohugo.io/templates/new-templatesystem-overview/
This commit is contained in:
parent
a83f339dc8
commit
230c46411b
102 changed files with 2 additions and 2 deletions
56
layouts/_partials/single/footer-scripts.html
Normal file
56
layouts/_partials/single/footer-scripts.html
Normal file
|
@ -0,0 +1,56 @@
|
|||
{{- /*
|
||||
Renders a single item's required footer JS scripts.
|
||||
|
||||
@params sc Site context.
|
||||
@params pc Page context.
|
||||
*/
|
||||
-}}
|
||||
|
||||
|
||||
<!-- Validation -->
|
||||
|
||||
{{- if ( not ( isset . "sc" ) ) -}}
|
||||
{{- errorf "No site context passed" -}}
|
||||
{{- end -}}
|
||||
|
||||
{{- if ( not ( isset . "pc" ) ) -}}
|
||||
{{- errorf "No page context passed" -}}
|
||||
{{- end -}}
|
||||
|
||||
{{- if ( and ( .pc.HasShortcode "chart" ) ( not ( .pc.Page.Resources.GetMatch "charts-init" ) ) ) -}}
|
||||
{{- errorf "No 'chart-init' page resource defined (%q)" .pc.Page.File.Path -}}
|
||||
{{- end -}}
|
||||
|
||||
|
||||
<!-- Rendering -->
|
||||
|
||||
{{ if .pc.Params.locations }}
|
||||
<script>
|
||||
{{-
|
||||
(
|
||||
partialCached
|
||||
"scripts/show_post_locations_on_map.js"
|
||||
( dict
|
||||
"pc" .pc
|
||||
"locations_data" .sc.Site.Data.locations
|
||||
"locations" .pc.Params.locations
|
||||
)
|
||||
.pc.Params.locations
|
||||
) | safeJS
|
||||
-}}
|
||||
</script>
|
||||
{{ end }}
|
||||
|
||||
{{ if .pc.HasShortcode "chart" }}
|
||||
{{- $configJs := ( .pc.Page.Resources.GetMatch "charts-init" | fingerprint ) -}}
|
||||
<script>
|
||||
{{-
|
||||
(
|
||||
partialCached
|
||||
"scripts/charts.js"
|
||||
$configJs
|
||||
$configJs
|
||||
) | safeJS
|
||||
-}}
|
||||
</script>
|
||||
{{ end }}
|
32
layouts/_partials/single/main-body/appendices.html
Normal file
32
layouts/_partials/single/main-body/appendices.html
Normal file
|
@ -0,0 +1,32 @@
|
|||
{{- /*
|
||||
Displays appendices 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 -->
|
||||
|
||||
<section class="article-body__appendices">
|
||||
<h2
|
||||
class="subheading subheading--appendices"
|
||||
id="appendices"
|
||||
>
|
||||
Appendices
|
||||
</h2>
|
||||
{{ $file := path.Join $.sc.Page.File.Dir "appendices.md" | readFile }}
|
||||
{{ $file | .pc.RenderString }}
|
||||
</section>
|
33
layouts/_partials/single/main-body/comments.html
Normal file
33
layouts/_partials/single/main-body/comments.html
Normal file
|
@ -0,0 +1,33 @@
|
|||
{{- /*
|
||||
Displays comments 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 -->
|
||||
|
||||
<section class="site-content__comments">
|
||||
<h2
|
||||
class="subheading subheading--comments"
|
||||
id="comments"
|
||||
>
|
||||
Comments
|
||||
</h2>
|
||||
<ul class="comment__thread">
|
||||
{{ .pc.RenderShortcodes }}
|
||||
</ul>
|
||||
</section>
|
28
layouts/_partials/single/main-body/content.html
Normal file
28
layouts/_partials/single/main-body/content.html
Normal file
|
@ -0,0 +1,28 @@
|
|||
{{- /*
|
||||
Displays main content 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 -->
|
||||
|
||||
<section
|
||||
class="e-content article-body__content"
|
||||
itemprop="articleBody"
|
||||
>
|
||||
{{ .pc.Content }}
|
||||
</section>
|
37
layouts/_partials/single/main-body/corrigendum.html
Normal file
37
layouts/_partials/single/main-body/corrigendum.html
Normal file
|
@ -0,0 +1,37 @@
|
|||
{{- /*
|
||||
Displays corrigenda 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 -->
|
||||
|
||||
<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 $.sc.Page.File.Dir "corrigendum.md" | readFile }}
|
||||
{{ $file | .pc.RenderString }}
|
||||
</section>
|
36
layouts/_partials/single/main-body/links.html
Normal file
36
layouts/_partials/single/main-body/links.html
Normal file
|
@ -0,0 +1,36 @@
|
|||
{{- /*
|
||||
Displays internal and external links for an item
|
||||
|
||||
@params pc Page context
|
||||
@params sc Site context
|
||||
*/
|
||||
-}}
|
||||
|
||||
|
||||
<!-- Variable assignment -->
|
||||
|
||||
{{- $params := . -}}
|
||||
|
||||
|
||||
<!-- Validation -->
|
||||
|
||||
{{- if ( not ( isset $params "sc" ) ) -}}
|
||||
{{- errorf "No site context received" -}}
|
||||
{{- end -}}
|
||||
|
||||
{{- if ( not ( isset $params "pc" ) ) -}}
|
||||
{{- errorf "No page context received (%q)" $params.sc.Page.File.Dir -}}
|
||||
{{- end -}}
|
||||
|
||||
|
||||
<!-- Rendering -->
|
||||
|
||||
<section class="article__links">
|
||||
{{- if $params.pc.Params.internal_links -}}
|
||||
{{- partial "single/main-body/links/internal-links.html" $params -}}
|
||||
{{- end -}}
|
||||
|
||||
{{- if $params.pc.Params.external_links -}}
|
||||
{{- partial "single/main-body/links/external-links.html" $params -}}
|
||||
{{- end -}}
|
||||
</section>
|
40
layouts/_partials/single/main-body/links/external-links.html
Normal file
40
layouts/_partials/single/main-body/links/external-links.html
Normal file
|
@ -0,0 +1,40 @@
|
|||
{{- /*
|
||||
Displays a list of external links
|
||||
|
||||
@params pc Page context
|
||||
@params sc Site context
|
||||
*/
|
||||
-}}
|
||||
|
||||
|
||||
<!-- Variable assignment -->
|
||||
|
||||
{{- $params := . -}}
|
||||
|
||||
|
||||
<!-- Validation -->
|
||||
|
||||
{{- if ( not ( isset $params "sc" ) ) -}}
|
||||
{{- errorf "No site context received" -}}
|
||||
{{- end -}}
|
||||
|
||||
{{- if ( not ( isset $params "pc" ) ) -}}
|
||||
{{- errorf "No page context received (%q)" $params.sc.Page.File.Dir -}}
|
||||
{{- end -}}
|
||||
|
||||
|
||||
<!-- Rendering -->
|
||||
|
||||
<h3>External Links</h3>
|
||||
<ul>
|
||||
{{- range $params.pc.Params.external_links -}}
|
||||
{{ if eq ( printf "%T" . ) "map[string]interface {}" }}
|
||||
{{ if ( isset . "name" ) }}
|
||||
{{- errorf "Name is set (%q)" $params.sc.Page.File.Dir -}}
|
||||
{{ end }}
|
||||
{{- partial "single/main-body/links/link/title-link.html" ( $params | merge ( dict "title" .title "link" .link ) ) }}
|
||||
{{ else }}
|
||||
{{- partial "single/main-body/links/link/basic-link.html" $params }}
|
||||
{{ end }}
|
||||
{{- end -}}
|
||||
</ul>
|
46
layouts/_partials/single/main-body/links/internal-links.html
Normal file
46
layouts/_partials/single/main-body/links/internal-links.html
Normal file
|
@ -0,0 +1,46 @@
|
|||
{{- /*
|
||||
Displays a list of internal links
|
||||
|
||||
@params pc Page context
|
||||
@params sc Site context
|
||||
*/
|
||||
-}}
|
||||
|
||||
|
||||
<!-- Variable assignment -->
|
||||
|
||||
{{- $params := . -}}
|
||||
|
||||
|
||||
<!-- Validation -->
|
||||
|
||||
{{- if ( not ( isset $params "sc" ) ) -}}
|
||||
{{- errorf "No site context received" -}}
|
||||
{{- end -}}
|
||||
|
||||
{{- if ( not ( isset $params "pc" ) ) -}}
|
||||
{{- errorf "No page context received (%q)" $params.sc.Page.File.Dir -}}
|
||||
{{- end -}}
|
||||
|
||||
|
||||
<!-- Rendering -->
|
||||
|
||||
<h3>Internal Links</h3>
|
||||
<ul>
|
||||
{{- range $params.pc.Params.internal_links -}}
|
||||
{{ if eq ( printf "%T" . ) "map[string]interface {}" }}
|
||||
{{ if ( isset . "name" ) }}
|
||||
{{- errorf "Name is set (%q)" $params.sc.Page.File.Dir -}}
|
||||
{{ end }}
|
||||
{{- if ( isset . "src" ) -}}
|
||||
{{- partial "single/main-body/links/link/page-resource-link.html" ( $params | merge ( dict "title" .title "src" .src ) ) }}
|
||||
{{- else if ( isset . "ref" ) -}}
|
||||
{{- partial "single/main-body/links/link/page-link.html" ( $params | merge ( dict "title" .title "ref" .ref ) ) }}
|
||||
{{- else -}}
|
||||
{{- partial "single/main-body/links/link/title-link.html" ( $params | merge ( dict "title" .title "link" .link ) ) }}
|
||||
{{- end -}}
|
||||
{{ else }}
|
||||
{{- partial "single/main-body/links/link/basic-link.html" $params }}
|
||||
{{ end }}
|
||||
{{- end -}}
|
||||
</ul>
|
|
@ -0,0 +1,23 @@
|
|||
{{- /*
|
||||
Displays an internal link without a title
|
||||
|
||||
@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 -->
|
||||
|
||||
<li><a href="{{ . }}">Link</a></li>
|
36
layouts/_partials/single/main-body/links/link/page-link.html
Normal file
36
layouts/_partials/single/main-body/links/link/page-link.html
Normal file
|
@ -0,0 +1,36 @@
|
|||
{{- /*
|
||||
Displays an internal link from another Page on the site.
|
||||
|
||||
@params sc Site context
|
||||
@params ref Page ref
|
||||
*/
|
||||
-}}
|
||||
|
||||
|
||||
<!-- Variable assignment -->
|
||||
{{- $page := $.sc.GetPage .ref -}}
|
||||
|
||||
|
||||
<!-- 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 -}}
|
||||
|
||||
{{- if ( not $page ) -}}
|
||||
{{- errorf "No Page found for ref '%q' (%q)." .ref $.sc.Page.File.Path -}}
|
||||
{{- end -}}
|
||||
|
||||
|
||||
<!-- Rendering -->
|
||||
|
||||
<li>
|
||||
{{- $.title | $page.Page.RenderString -}}:
|
||||
<a href="{{ $page.RelPermalink }}">
|
||||
{{- default $page.Title $page.Params.markup_title | $page.Page.RenderString -}}
|
||||
</a>
|
||||
</li>
|
|
@ -0,0 +1,37 @@
|
|||
{{- /*
|
||||
Displays an internal link from a page resource
|
||||
|
||||
@params pc Page context
|
||||
@params sc Site context
|
||||
@params src Page resource source
|
||||
*/
|
||||
-}}
|
||||
|
||||
|
||||
<!-- Variable assignment -->
|
||||
{{- $src := $.sc.Page.Resources.GetMatch .src -}}
|
||||
|
||||
|
||||
<!-- 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 -}}
|
||||
|
||||
{{- if ( not $src ) -}}
|
||||
{{- errorf "No Page Resource found for src '%q' (%q).\n\n\tAvailable Page Resources are:\n\t\t%v" .src $.sc.Page.File.Path $.sc.Page.Resources -}}
|
||||
{{- end -}}
|
||||
|
||||
|
||||
<!-- Rendering -->
|
||||
|
||||
<li>
|
||||
<a href="{{ $src.RelPermalink }}"
|
||||
>{{ .title | $.sc.RenderString | safeHTML }}
|
||||
(<code>.{{- delimit ( last 1 ( split $src.RelPermalink "." ) ) "" -}}</code>)</a
|
||||
>
|
||||
</li>
|
|
@ -0,0 +1,32 @@
|
|||
{{- /*
|
||||
Displays an internal link with a title
|
||||
|
||||
@params pc Page context
|
||||
@params sc Site context
|
||||
@params link Link URL
|
||||
*/
|
||||
-}}
|
||||
|
||||
|
||||
<!-- 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 -}}
|
||||
|
||||
{{- if ( or ( not ( isset . "title" ) ) ( eq .title "" ) ) -}}
|
||||
{{- warnf "No title found (%q)" $.sc.Page.File.Path -}}
|
||||
{{- end -}}
|
||||
|
||||
{{- if not ( hasPrefix .link "http" ) -}}
|
||||
{{- warnf "Link '%q' is not a URL, did you mean to use 'src'? (%q)" .link $.sc.Page.File.Path -}}
|
||||
{{- end -}}
|
||||
|
||||
|
||||
<!-- Rendering -->
|
||||
|
||||
<li><a href="{{ .link }}">{{ .title | $.sc.RenderString | safeHTML }}</a></li>
|
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>
|
25
layouts/_partials/single/main-header/authors.html
Normal file
25
layouts/_partials/single/main-header/authors.html
Normal file
|
@ -0,0 +1,25 @@
|
|||
{{- /*
|
||||
Renders the authors for an item.
|
||||
|
||||
@params authors The item's author(s).
|
||||
@params sc The site context.
|
||||
*/ -}}
|
||||
|
||||
<span style="display: none">
|
||||
<p>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>
|
||||
</p>
|
||||
{{- end -}}
|
||||
</span>
|
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>
|
67
layouts/_partials/single/main-header/item-tile.html
Normal file
67
layouts/_partials/single/main-header/item-tile.html
Normal file
|
@ -0,0 +1,67 @@
|
|||
{{- /*
|
||||
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" . ) .Title -}}
|
||||
{{- 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" . ) .Title -}})"
|
||||
{{ else }}
|
||||
{{- if $.pc.Page.Resources -}}
|
||||
{{- errorf "No Page Resource found for src '%q' (%q).\n\n\tAvailable Page Resources are:\n\t\t%v" . $.pc.Page.File.Path $.pc.Page.Resources -}}
|
||||
{{- else -}}
|
||||
{{- warnf "No Page Resource found for src '%q' (%q)." . $.pc.Page.File.Path -}}
|
||||
{{- end -}}
|
||||
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>
|
||||
{{- with .pc.File -}}
|
||||
{{- partial "text/item-title.html" ( dict "pc" $.pc "sc" $.sc "class" "article-header" ) -}}
|
||||
{{- else -}}
|
||||
{{- partial "text/item-title.html" ( dict "pc" $.pc "sc" $.sc "class" "article-header" ) -}}
|
||||
{{- end -}}
|
||||
</div>
|
||||
|
||||
{{ with ( .pc.Resources.GetMatch .pc.Params.featured_image ) }}
|
||||
{{- partial "media/attr.html" ( dict "pc" $.pc "sc" $.sc "params" .Params ) -}}
|
||||
{{ 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>{{ default .Title .Params.markup_title | .Page.RenderString }}</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>
|
Loading…
Add table
Add a link
Reference in a new issue