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
7
layouts/_partials/archetypes/base-meta.yml
Normal file
7
layouts/_partials/archetypes/base-meta.yml
Normal file
|
@ -0,0 +1,7 @@
|
|||
# Meta
|
||||
title: "{{ replace .Name "-" " " | title }}"
|
||||
subtitle:
|
||||
summary:
|
||||
date: {{ .Date }}
|
||||
draft: true
|
||||
|
9
layouts/_partials/archetypes/base-resources.yml
Normal file
9
layouts/_partials/archetypes/base-resources.yml
Normal file
|
@ -0,0 +1,9 @@
|
|||
# Resources
|
||||
featured_image: {{ .Name }}
|
||||
resources:
|
||||
- name: {{ .Name }}
|
||||
src: images/{{ .Name }}.*
|
||||
params:
|
||||
alt:
|
||||
attr:
|
||||
|
13
layouts/_partials/archetypes/base-taxonomies.yml
Normal file
13
layouts/_partials/archetypes/base-taxonomies.yml
Normal file
|
@ -0,0 +1,13 @@
|
|||
# Taxonomies
|
||||
organisations:
|
||||
-
|
||||
locations:
|
||||
-
|
||||
colleagues:
|
||||
-
|
||||
areas:
|
||||
-
|
||||
skills:
|
||||
-
|
||||
tags:
|
||||
-
|
134
layouts/_partials/cite.html
Normal file
134
layouts/_partials/cite.html
Normal file
|
@ -0,0 +1,134 @@
|
|||
{{- /*
|
||||
Renders a work citation with semantic markup, called using the `cite` shortcode.
|
||||
|
||||
@params sc Site context.
|
||||
@params pc Page context.
|
||||
|
||||
@params cite URI for work. Optional.
|
||||
@params citeStyle Force a citation style. Optional.
|
||||
@params href URI for citation, or 'asCite' to use value of `cite`. Optional.
|
||||
@params itemtype The Schema.org `itemtype` value. Default 'CreativeWork'.
|
||||
@params shortTitle Abbreviated display title. Optional.
|
||||
@params title Title of the work to display.
|
||||
@params titleLang Language code of a foreign-language work's title. Optional.
|
||||
@params titleTr English translation of a foreign-language work's title. Optional.
|
||||
|
||||
For works cited that form part of a series (optional):
|
||||
@params itemtypeSeries The Schema.org `itemtype` value for the work series. Default 'CreativeWork'. Optional.
|
||||
@params titleSeries Title of the work series to display. Optional.
|
||||
@params citeSeries URI for work series. Optional.
|
||||
@params titleSeriesLang Language code of a foreign-language work series' title. Optional.
|
||||
@params titleSeriesTr English translation of a foreign-language work series' title. Optional.
|
||||
@params numberSeries The number or code of the quoted work within its series. Optional.
|
||||
*/ -}}
|
||||
|
||||
<!-- Optional parameter overrides (for nested citations) -->
|
||||
|
||||
{{- $citeText := .Params.cite }}
|
||||
{{- $replacedCite := replaceRE `^([a-z]+?://)?(www)?` "" $citeText }}
|
||||
{{- $startOfCite := delimit ( findRE `^([a-z]+?://)?(www)?` $citeText 1 ) "" }}
|
||||
{{- $cite := replaceRE `^` $startOfCite ( trim ( $replacedCite | .pc.Page.RenderString ) "\r\n" ) -}}
|
||||
|
||||
{{- $title := trim ( .Params.title | .pc.Page.RenderString ) "\r\n" -}}
|
||||
{{- $titleLang := .Params.titleLang -}}
|
||||
{{- $titleTr := .Params.titleTr -}}
|
||||
{{- $itemtype := .Params.itemtype -}}
|
||||
|
||||
{{- if ( strings.Contains $cite "#" ) -}}
|
||||
{{- erroridf "cite-with-fragment" "Cite parameter includes fragment identifier, which probably isn't what you want." -}}
|
||||
{{- $cite = delimit ( split $cite "#" ) "" -}}
|
||||
{{- end -}}
|
||||
|
||||
<!-- Validation -->
|
||||
|
||||
{{- if ( and ( isset .Params "citeStyle" ) ( not ( in ( slice "inherit" "enquote" "normal" ) .Params.citeStyle ) ) ) -}}
|
||||
{{- erroridf "invalid-citeStyle" "Invalid `citeStyle` value %q for %q" .Params.citeStyle $title -}}
|
||||
{{- end -}}
|
||||
|
||||
<!-- TODO: check `.Params.href` is URI or 'asCite' -->
|
||||
|
||||
{{- if ( and $itemtype ( not ( in .sc.Site.Data.itemtypes $itemtype ) ) ) -}}
|
||||
{{- erroridf "invalid-itemtype" "Invalid Schema.org type value '%s' for %s (%q)\r\n%q" $itemtype .Params.title .sc.Page.File.Dir .Params -}}
|
||||
{{- end -}}
|
||||
|
||||
<!-- TODO: check `.Params.cite` is URI -->
|
||||
|
||||
{{- if ( or $titleLang $titleTr ) -}}
|
||||
{{- if ( not ( and $titleLang $titleTr ) ) -}}
|
||||
{{- erroridf "invalid-foreign-title" "Must have both title translation and language set for foreign language title %q" $title -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
|
||||
<!-- Variable assignment -->
|
||||
|
||||
{{- $hasCitedWork := ( isset .Params "title" ) }}
|
||||
{{- $hasCitedSeries := ( isset .Params "titleSeries" ) -}}
|
||||
|
||||
<!-- Rendering -->
|
||||
|
||||
{{- $itemType := default "CreativeWork" $itemtype -}}
|
||||
{{- if ( or ( in .sc.Site.Data.itemtypes $itemType ) ( eq .Params.suppress "true" ) ) -}}
|
||||
{{- with .Params.href -}}
|
||||
<a href="{{- if eq . "asCite" -}}{{- $cite -}}{{- else -}}{{- . -}}{{- end -}}">
|
||||
{{- end -}}
|
||||
<cite
|
||||
class="cite{{ with .Params.citeStyle }} cite--{{ . }}{{ end }}"
|
||||
itemscope
|
||||
itemprop="citation"
|
||||
itemtype="https://schema.org/{{- $itemType -}}"
|
||||
{{- if $titleLang -}}
|
||||
lang="{{- $titleLang -}}"
|
||||
title="{{- $titleTr -}}"
|
||||
{{- end -}}>
|
||||
{{- with $cite -}}
|
||||
<meta itemprop="url" content="{{- . -}}">
|
||||
{{- end -}}
|
||||
<span itemprop="name">
|
||||
{{- if $titleLang -}}
|
||||
<i
|
||||
lang="{{ $titleLang }}"
|
||||
title="
|
||||
{{- if $.Params.shortTitle -}}
|
||||
{{- printf "%s [%s]" $title $titleTr | plainify -}}
|
||||
{{- else -}}
|
||||
{{- $titleTr | plainify -}}
|
||||
{{- end -}}
|
||||
"
|
||||
>
|
||||
{{- end -}}
|
||||
|
||||
{{- ( default $title .Params.shortTitle ) | markdownify | safeHTML -}}
|
||||
|
||||
{{- if $titleLang -}}
|
||||
</i>
|
||||
{{- end -}}
|
||||
</span>{{- /**/ -}}
|
||||
</cite>
|
||||
{{- with .Params.href -}}
|
||||
</a>
|
||||
{{- end -}}
|
||||
|
||||
{{- if $hasCitedSeries }}
|
||||
(<span itemprop="partOfSeries">
|
||||
{{- partial "cite.html" (
|
||||
dict
|
||||
"sc" $.sc
|
||||
"pc" $.pc
|
||||
"Params" (
|
||||
dict
|
||||
"cite" .Params.citeSeries
|
||||
"title" .Params.titleSeries
|
||||
"titleLang" .Params.titleSeriesLang
|
||||
"titleTr" .Params.titleSeriesTr
|
||||
"itemtype" .Params.itemtypeSeries
|
||||
"href" .Params.hrefSeries
|
||||
)
|
||||
) -}}
|
||||
</span>
|
||||
{{- with .Params.seasonNumber }}, S<span itemprop="partOfSeason">{{ . }}</span>{{- end -}}
|
||||
{{- with .Params.episodeNumber }}, E<span itemprop="episodeNumber">{{ . }}</span>{{- end -}}
|
||||
)
|
||||
{{- end -}}
|
||||
{{- else -}}
|
||||
{{- erroridf "invalid-schema-type" "Invalid Schema.org type value %q for %q" $itemType $title -}}
|
||||
{{- end -}}
|
14
layouts/_partials/copying.html
Normal file
14
layouts/_partials/copying.html
Normal file
|
@ -0,0 +1,14 @@
|
|||
{{ "<!--" | safeHTML }}
|
||||
{{ .Site.Title}} - {{ .Site.Params.tagline }}
|
||||
|
||||
This page was created by {{ fmt.Printf "%s <%s>" .Site.Params.Author.name .Site.Params.adminEmail | safeHTML }}.
|
||||
The date of creation and last modification should be available within the page
|
||||
below.
|
||||
|
||||
Unless stated otherwise, and to the extent possible under law, the author has
|
||||
dedicated all copyright and related and neighbouring rights to this content
|
||||
to the public domain worldwide. This file is distributed without any warranty.
|
||||
|
||||
See <http://creativecommons.org/publicdomain/zero/1.0/> for
|
||||
a copy of the CC0 Public Domain Dedication.
|
||||
{{ "-->" | safeHTML }}
|
50
layouts/_partials/cv/locations/heatmap.js
Normal file
50
layouts/_partials/cv/locations/heatmap.js
Normal file
|
@ -0,0 +1,50 @@
|
|||
{{/*
|
||||
Recursively render an ordered or unordered list from a set of arbitrarily-
|
||||
deeply-nested items.
|
||||
|
||||
@params all_pages All site pages
|
||||
@params locations All locations
|
||||
*/}}
|
||||
|
||||
<script>
|
||||
var map = L.map('map', {
|
||||
fullscreenControl: true
|
||||
}).setView([55, -3], 3);
|
||||
|
||||
L.tileLayer('https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', {
|
||||
maxZoom: 19,
|
||||
attribution: '© <a href="https://www.openstreetmap.org/copyright">OpenStreetMap</a>'
|
||||
}).addTo(map);
|
||||
|
||||
{{- $locations := partialCached "util/get_location_leaf_nodes.html" .locations -}}
|
||||
|
||||
{{/*
|
||||
{{- range .Site.AllPages -}}
|
||||
{{- with .Params.locations -}}
|
||||
{{- range . -}}
|
||||
{{- with ( index $locations ( replaceRE `, [A-Z]+` "" . ) ) -}}
|
||||
L.marker([{{ .lat }}, {{ .lon }}]).addTo(map);
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
*/}}
|
||||
|
||||
L.heatLayer(
|
||||
[
|
||||
{{- range .all_pages -}}
|
||||
{{- with .Params.locations -}}
|
||||
{{- range . -}}
|
||||
{{- with ( index $locations ( replaceRE `, [A-Z]+` "" . ) ) -}}
|
||||
[ {{ .lat }}, {{ .lon }} ],
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
],
|
||||
{
|
||||
minOpacity: 0.5,
|
||||
gradient: {0.1: 'blue', 0.3: 'lime', 0.8: 'orange', 1: 'red'}
|
||||
}
|
||||
).addTo(map);
|
||||
</script>
|
9
layouts/_partials/cv/organisation/description.html
Normal file
9
layouts/_partials/cv/organisation/description.html
Normal file
|
@ -0,0 +1,9 @@
|
|||
<!--
|
||||
Renders the description of an organisation.
|
||||
|
||||
@params content Organisation description.
|
||||
-->
|
||||
|
||||
<section id="description" class="organisation__description">
|
||||
{{ .content }}
|
||||
</section>
|
38
layouts/_partials/cv/organisation/get-num-of-items.html
Normal file
38
layouts/_partials/cv/organisation/get-num-of-items.html
Normal file
|
@ -0,0 +1,38 @@
|
|||
<!--
|
||||
Return the number of a certain type of items an organisation has.
|
||||
|
||||
@params sc Site context.
|
||||
@params section_title Title of the sub-section to show (e.g. "Blog Posts").
|
||||
@params organisation_titles `dict` of organsation titles for this org and all of its children.
|
||||
-->
|
||||
|
||||
{{- $sc := .sc -}}
|
||||
{{- $section_title := .section_title -}}
|
||||
{{- $organisation_titles := .organisation_titles -}}
|
||||
|
||||
{{- $icon := dict
|
||||
"Roles" "🔨"
|
||||
"Blog Posts" "📌"
|
||||
"Web Sites" "✉"
|
||||
"Programs" "P"
|
||||
"Writings" "🖉"
|
||||
"Audiovisuals" "AV"
|
||||
"Others" "?"
|
||||
"Qualifications" "Q"
|
||||
"Awards" "A"
|
||||
"Appearances" "ME"
|
||||
-}}
|
||||
|
||||
{{- $section_items := default
|
||||
( where ( where $sc.Site.Pages "Section" "blog" ) "Parent.Title" $section_title )
|
||||
( default
|
||||
( where ( where $sc.Site.Pages "Section" "cv" ) "Parent.Title" $section_title )
|
||||
( where ( where $sc.Site.Pages "Section" "portfolio" ) "Parent.Title" $section_title )
|
||||
)
|
||||
-}}
|
||||
|
||||
{{- $organisation_items := where $section_items ".Params.organisations" "intersect" $organisation_titles -}}
|
||||
<span class="organisations-table__items-icon{{- if ( eq ( len $organisation_items ) 0 ) }} organisations-table__items-icon--none{{- end -}}">
|
||||
{{- index $icon $section_title -}} <br>
|
||||
{{- ( len $organisation_items ) -}}
|
||||
</span>
|
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 -}}
|
|
@ -0,0 +1,47 @@
|
|||
<!--
|
||||
Renders an organisation's parents as a slice.
|
||||
|
||||
@params sc Site context.
|
||||
@params pc Page context.
|
||||
@params organisation Organisation title.
|
||||
-->
|
||||
|
||||
<!-- Validation -->
|
||||
|
||||
{{- if ( not ( isset . "sc" ) ) -}}
|
||||
{{- errorf "No site context passed" -}}
|
||||
{{- end -}}
|
||||
|
||||
{{- if ( not ( isset . "pc" ) ) -}}
|
||||
{{- errorf "No page context passed" -}}
|
||||
{{- end -}}
|
||||
|
||||
{{- if ( not ( isset . "organisation" ) ) -}}
|
||||
{{- errorf "No organisation passed" -}}
|
||||
{{- end -}}
|
||||
|
||||
<!-- Variable Assignment -->
|
||||
|
||||
{{- $parents := slice -}}
|
||||
|
||||
<!-- Rendering -->
|
||||
|
||||
{{- $organisations_pages := ( where .sc.Site.Pages "Type" "cv" ) -}}
|
||||
{{- $matching_organisations_pages := where $organisations_pages "Title" .organisation -}}
|
||||
{{- range $matching_organisations_pages -}}
|
||||
{{- if ( and ( $.pc.Params.redact ) ( ne $.sc.Site.Params.redact "show" ) ) -}}
|
||||
{{- if ( eq $.sc.Site.Params.redact "black" ) -}}
|
||||
{{- $parents = ( $parents | append "███████████████" ) -}}
|
||||
{{- end -}}
|
||||
|
||||
{{- else -}}
|
||||
{{- $parents = ( $parents | append ( .Title | htmlUnescape | plainify ) ) -}}
|
||||
|
||||
{{- end -}}
|
||||
|
||||
{{- else -}}
|
||||
{{ erroridf "missing-organisation" "Could not find organisation '%q' (%q)" .organisation $.pc.File.Path }}
|
||||
|
||||
{{- end -}}
|
||||
|
||||
{{- return $parents -}}
|
50
layouts/_partials/cv/organisation/get_role_colour.html
Normal file
50
layouts/_partials/cv/organisation/get_role_colour.html
Normal file
|
@ -0,0 +1,50 @@
|
|||
<!--
|
||||
Renders a role's class (i.e. colour based on paid/unpaid).
|
||||
|
||||
@params end_date The end date of the role, or undefined if the role is ongoing.
|
||||
@params is_paid Whether the role is paid or not.
|
||||
-->
|
||||
|
||||
<!-- Validation -->
|
||||
|
||||
{{- if ( not ( isset . "end_date" ) ) -}}
|
||||
{{- errorf "No end date passed" -}}
|
||||
{{- end -}}
|
||||
|
||||
{{- if ( not ( isset . "is_paid" ) ) -}}
|
||||
{{- errorf "No 'is_paid' passed" -}}
|
||||
{{- end -}}
|
||||
|
||||
|
||||
<!-- Variable Assignment -->
|
||||
|
||||
{{- $end_date := .end_date -}}
|
||||
{{- $is_paid := .is_paid -}}
|
||||
|
||||
|
||||
<!-- Variable Initialisation -->
|
||||
|
||||
{{- $unpaid_past := "#FFFFF0" -}}
|
||||
{{- $paid_past := "#FCFCA6" -}}
|
||||
{{- $unpaid_current := "#BBBBB0" -}}
|
||||
{{- $paid_current := "#BCBC7E" -}}
|
||||
{{- $colour := "" -}}
|
||||
|
||||
|
||||
<!-- Rendering -->
|
||||
|
||||
{{- if $end_date -}}
|
||||
{{- if $is_paid -}}
|
||||
{{- $colour = $paid_past -}}
|
||||
{{- else -}}
|
||||
{{- $colour = $unpaid_past -}}
|
||||
{{- end -}}
|
||||
{{- else -}}
|
||||
{{- if $is_paid -}}
|
||||
{{- $colour = $paid_current -}}
|
||||
{{- else -}}
|
||||
{{- $colour = $unpaid_current -}}
|
||||
{{- end -}}
|
||||
{{- end }}
|
||||
|
||||
{{- return $colour -}}
|
21
layouts/_partials/cv/organisation/get_role_end_date.html
Normal file
21
layouts/_partials/cv/organisation/get_role_end_date.html
Normal file
|
@ -0,0 +1,21 @@
|
|||
<!--
|
||||
Renders a role's end date, or today if none is set.
|
||||
|
||||
@params . Role start date. Can be undefined.
|
||||
@return Date
|
||||
-->
|
||||
|
||||
<!-- Variable Initialisation -->
|
||||
|
||||
{{- $end_date := "" -}}
|
||||
|
||||
|
||||
<!-- Rendering -->
|
||||
|
||||
{{- if . -}}
|
||||
{{- $end_date = . -}}
|
||||
{{- else -}}
|
||||
{{- $end_date = ( now.Format "2006-01-02" ) -}}
|
||||
{{- end -}}
|
||||
|
||||
{{- return ( printf "new Date('%s')" $end_date ) -}}
|
|
@ -0,0 +1,38 @@
|
|||
|
||||
<!--
|
||||
Renders a role's organization(s) as a comma-delimited list.
|
||||
|
||||
@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 -}}
|
||||
|
||||
<!-- Variable Assignment -->
|
||||
|
||||
{{- $parents := slice -}}
|
||||
|
||||
<!-- Rendering -->
|
||||
|
||||
{{- with .pc.Params.organisations -}}
|
||||
{{- range . -}}
|
||||
{{-
|
||||
$parents = $parents | append (
|
||||
partialCached
|
||||
"cv/organisation/get_organisation_parents.html"
|
||||
( dict "sc" $.sc "pc" $.pc "organisation" . )
|
||||
.
|
||||
)
|
||||
-}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
|
||||
{{- return ( delimit $parents ", ") -}}
|
35
layouts/_partials/cv/organisation/get_role_role_string.html
Normal file
35
layouts/_partials/cv/organisation/get_role_role_string.html
Normal file
|
@ -0,0 +1,35 @@
|
|||
|
||||
<!--
|
||||
Renders a role's role.
|
||||
|
||||
@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 -}}
|
||||
|
||||
<!-- Variable Assignment -->
|
||||
|
||||
{{- $role_text := "" -}}
|
||||
|
||||
<!-- Rendering -->
|
||||
|
||||
{{- if ( and ( .pc.Params.redact ) ( ne .sc.Site.Params.redact "show" ) ) -}}
|
||||
{{- if ( eq .sc.Site.Params.redact "black" ) -}}
|
||||
{{- $role_text = "███████████████" -}}
|
||||
|
||||
{{- end -}}
|
||||
|
||||
{{- else -}}
|
||||
{{- $role_text = .pc.Title | htmlUnescape | plainify -}}
|
||||
{{- end -}}
|
||||
|
||||
{{- return $role_text -}}
|
17
layouts/_partials/cv/organisation/get_role_start_date.html
Normal file
17
layouts/_partials/cv/organisation/get_role_start_date.html
Normal file
|
@ -0,0 +1,17 @@
|
|||
<!--
|
||||
Renders a role's start date.
|
||||
|
||||
@params . Role start date.
|
||||
@return Date
|
||||
-->
|
||||
|
||||
<!-- Validation -->
|
||||
|
||||
{{- if ( not ( eq (printf "%T" . ) "time.Time" ) ) -}}
|
||||
{{- errorf "Start date is not a `time.Time`, it's a %T" . -}}
|
||||
{{- end -}}
|
||||
|
||||
|
||||
<!-- Rendering -->
|
||||
|
||||
{{- return ( printf "new Date('%s')" ( .Format "2006-01-02" ) ) -}}
|
|
@ -0,0 +1,11 @@
|
|||
<!--
|
||||
Gets the top-level parent org of an organisation.
|
||||
|
||||
@params organisation The organisation to search for.
|
||||
-->
|
||||
|
||||
{{- $organisation_page := default . ( index .Ancestors.Reverse 3 ) -}}
|
||||
{{- $organisation_title := default $organisation_page.Title $organisation_page.Params.markup_title -}}
|
||||
|
||||
{{- return $organisation_title -}}
|
||||
|
|
@ -0,0 +1,34 @@
|
|||
<!--
|
||||
Renders related items as an unordered list.
|
||||
|
||||
@params section_title Title of the sub-section to show (e.g. "Blog Posts").
|
||||
@params content Related items.
|
||||
-->
|
||||
|
||||
{{- $section_title := .section_title -}}
|
||||
{{- $content := .content -}}
|
||||
|
||||
<h2 class="subheading">{{ $section_title }} ({{ len $content }})</h2>
|
||||
<ul class="related-items related-items--list">
|
||||
{{- range $content -}}
|
||||
{{- $is_expired := and ( isset .Params "end_date" ) ( lt .Params.end_date ( (time now).Format "2006-01-02" ) ) -}}
|
||||
|
||||
<li class="related-item{{- if $is_expired }} related-item--expired{{- end -}}">
|
||||
<a href="{{- .RelPermalink -}}">
|
||||
{{- .Title | safeHTML -}}
|
||||
</a>
|
||||
|
||||
{{- with .Params.grade -}}
|
||||
<span class="related-item__grade">
|
||||
Grade: {{ . -}}
|
||||
</span>
|
||||
{{- end -}}
|
||||
|
||||
{{- with .Params.end_date -}}
|
||||
<span class="related-item__expiry">
|
||||
<abbr title="expire{{- if $is_expired -}}d{{- else -}}s{{- end -}}">Exp</abbr>: {{ dateFormat "Jan 2 2006" . -}}
|
||||
</span>
|
||||
{{- end -}}
|
||||
</li>
|
||||
{{- end -}}
|
||||
</ul>
|
|
@ -0,0 +1,36 @@
|
|||
<!--
|
||||
Renders related items as tiles.
|
||||
|
||||
@params section_title Title of the sub-section to show (e.g. "Blog Posts").
|
||||
@params organisation_title Title of the organisation.
|
||||
@params content Related items.
|
||||
-->
|
||||
|
||||
{{- $section_title := .section_title -}}
|
||||
{{- $organisation_title := .organisation_title -}}
|
||||
{{- $content := .content -}}
|
||||
|
||||
{{- if gt ( len $content ) 4 -}}
|
||||
<details class="related-items related-items--tiles related-items--collapsible">
|
||||
<summary>
|
||||
{{- else -}}
|
||||
<div id="{{ $section_title | anchorize }}" class="related-items related-items--tiles">
|
||||
{{- end -}}
|
||||
<h2 class="subheading related-items-title">{{ $section_title }} ({{ len $content }})</h2>
|
||||
<div class="index">
|
||||
{{ range first 4 $content }}
|
||||
{{ partialCached "item-tile.html" . . }}
|
||||
{{ end }}
|
||||
</div>
|
||||
{{- if gt ( len $content ) 4 -}}
|
||||
</summary>
|
||||
|
||||
<div class="index">
|
||||
{{ range after 4 $content }}
|
||||
{{ partialCached "item-tile.html" . . }}
|
||||
{{ end }}
|
||||
</div>
|
||||
</details>
|
||||
{{ else }}
|
||||
</div>
|
||||
{{ end }}
|
30
layouts/_partials/cv/organisation/related-items-section.html
Normal file
30
layouts/_partials/cv/organisation/related-items-section.html
Normal file
|
@ -0,0 +1,30 @@
|
|||
<!--
|
||||
Renders the related items for a given organisation for a given section.
|
||||
|
||||
@params sc Site context
|
||||
@params tls Slug of the top-level section of the sub-section.
|
||||
@params section_title Title of the sub-section to show (e.g. "Blog Posts").
|
||||
@params organisation_titles `dict` of organsation titles for this org and all of its children.
|
||||
-->
|
||||
|
||||
{{- $sc := .sc -}}
|
||||
{{- $tls := .tls -}}
|
||||
{{- $section_title := .section_title -}}
|
||||
{{- $organisation_titles := .organisation_titles -}}
|
||||
|
||||
{{- range ( where ( ( $sc.GetPage $.tls ).Sections ) "Title" $.section_title ) -}}
|
||||
{{- $section_items := where ( where $sc.Site.Pages "Section" $tls ) "Parent.Title" .Title -}}
|
||||
{{- $organisation_items := where $section_items ".Params.organisations" "intersect" $organisation_titles -}}
|
||||
|
||||
{{- with ( where $organisation_items ".Params.redact" "ne" true ) -}}
|
||||
{{- if in ( slice "Qualifications" "Awards" ) $section_title -}}
|
||||
<section id="related-{{ $section_title | anchorize }}" class="related-section related-section--list">
|
||||
{{- partial "cv/organisation/organisation-items-list.html" ( dict "organisation_title" $sc.Title "section_title" $section_title "content" . ) -}}
|
||||
</section>
|
||||
{{- else -}}
|
||||
<section id="related-{{ $section_title | anchorize }}" class="related-section related-section--tiles">
|
||||
{{- partial "cv/organisation/organisation-items-tiles.html" ( dict "section_title" $section_title "content" . ) -}}
|
||||
</section>
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
26
layouts/_partials/cv/organisation/related-items.html
Normal file
26
layouts/_partials/cv/organisation/related-items.html
Normal file
|
@ -0,0 +1,26 @@
|
|||
<!--
|
||||
Renders the related items for a given organisation.
|
||||
|
||||
@params sc Site context
|
||||
@params organisation_titles `dict` of organsation titles for this org and all of its children.
|
||||
-->
|
||||
|
||||
{{- $sc := .sc -}}
|
||||
{{- $organisation_titles := .organisation_titles -}}
|
||||
|
||||
<section id="related" class="organisation__related">
|
||||
|
||||
<!-- Blog posts -->
|
||||
{{- partial "cv/organisation/related-items-section.html" ( dict "sc" $sc "tls" "blog" "section_title" "Blog Posts" "organisation_titles" $organisation_titles ) -}}
|
||||
|
||||
<!-- Portfolios -->
|
||||
{{- range ( ( $sc.GetPage "portfolio" ).Sections ).ByWeight -}}
|
||||
{{- partial "cv/organisation/related-items-section.html" ( dict "sc" $sc "tls" "portfolio" "section_title" .Title "organisation_titles" $organisation_titles ) -}}
|
||||
{{- end -}}
|
||||
|
||||
<!-- Qualifications, Awards and Appearances -->
|
||||
{{- range ( where ( ( $sc.GetPage "cv" ).Sections ) "Title" "not in" ( slice "Organisations" "Roles" ) ).ByWeight }}
|
||||
{{- partial "cv/organisation/related-items-section.html" ( dict "sc" $sc "tls" "cv" "section_title" .Title "organisation_titles" $organisation_titles ) -}}
|
||||
{{- end -}}
|
||||
|
||||
</section>
|
7
layouts/_partials/cv/organisation/roles-timeline.html
Normal file
7
layouts/_partials/cv/organisation/roles-timeline.html
Normal file
|
@ -0,0 +1,7 @@
|
|||
<!--
|
||||
Renders a role timeline for an organisation.
|
||||
-->
|
||||
|
||||
<section id="roles-timeline" class="organisation__timeline">
|
||||
<div id="timeline" aria-label="Roles timeline" role="img">Javascript must be enabled to view this chart.</div>
|
||||
</section>
|
83
layouts/_partials/cv/organisations/organisations-table.html
Normal file
83
layouts/_partials/cv/organisations/organisations-table.html
Normal file
|
@ -0,0 +1,83 @@
|
|||
<!--
|
||||
Renders the table list of organisations.
|
||||
-->
|
||||
|
||||
<section class="site-content__body">
|
||||
<table class="organisations-table">
|
||||
<thead>
|
||||
<tr>
|
||||
<th colspan="2">Organisation</th>
|
||||
<th>Children</th>
|
||||
<th>Related Items</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{{- range .Pages -}}
|
||||
{{- $organisation_title := .Title -}}
|
||||
{{- if ( not ( and ( .Params.redact ) ( ne $.Site.Params.redact "show" ) ) ) -}}
|
||||
{{ $organisation_titles := slice ( $organisation_title | plainify ) }}
|
||||
{{ with .Sections }}
|
||||
{{ $organisation_titles = $organisation_titles | append ( partial "cv/organisations/recursive-children-titles.html" . ) }}
|
||||
{{ end }}
|
||||
|
||||
<tr>
|
||||
|
||||
<td>
|
||||
{{- if ( and ( .Params.redact ) ( ne $.Site.Params.redact "show" ) ) -}}
|
||||
{{- if ( eq $.Site.Params.redact "black" ) -}}
|
||||
{{- partialCached "redact-black.html" . -}}
|
||||
{{- end -}}
|
||||
{{- else -}}
|
||||
{{- if .Params.featured_image -}}
|
||||
{{- with .Resources.GetMatch .Params.featured_image -}}
|
||||
<img class="organisations-table__logo" loading="lazy" src="{{- .RelPermalink -}}" {{ with .Params.bg }}style="background-color: {{ . }}"{{ end }}>
|
||||
{{- else -}}
|
||||
<img class="organisations-table__logo" loading="lazy" src="{{- .Params.featured_image -}}">
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
</td>
|
||||
|
||||
<td>
|
||||
{{- if ( and ( .Params.redact ) ( ne $.Site.Params.redact "show" ) ) -}}
|
||||
{{- if ( eq $.Site.Params.redact "black" ) -}}
|
||||
{{- partialCached "redact-black.html" . -}}
|
||||
{{- end -}}
|
||||
{{- else -}}
|
||||
<a href="{{ .RelPermalink }}">
|
||||
{{- if .Params.TitleLang -}}<i lang="{{ .Params.TitleLang }}" title="{{ .Params.TitleTrans }}"}>{{- end -}}
|
||||
{{- with .Params.markup_title -}}{{- . | $.Page.RenderString -}}{{- else -}}{{- $organisation_title | $.Page.RenderString -}}{{- end -}}
|
||||
{{- if .Params.TitleLang -}}</i>{{- end -}}
|
||||
</a>
|
||||
{{- end -}}
|
||||
</td>
|
||||
|
||||
<td>
|
||||
<span class="organisations-table__items-icon{{- if ( eq ( len .Sections ) 0 ) }} organisations-table__items-icon--none{{- end -}}">
|
||||
🧑🧒 <br>
|
||||
{{- len .Sections -}}
|
||||
</span>
|
||||
</td>
|
||||
|
||||
<td>
|
||||
{{- range slice
|
||||
"Roles"
|
||||
"Blog Posts"
|
||||
"Web Sites"
|
||||
"Programs"
|
||||
"Writings"
|
||||
"Audiovisuals"
|
||||
"Others"
|
||||
"Qualifications"
|
||||
"Awards"
|
||||
"Appearances"
|
||||
-}}
|
||||
{{- partialCached "cv/organisation/get-num-of-items.html" ( dict "sc" $ "section_title" . "organisation_titles" $organisation_titles ) ( print $organisation_title "_" . ) -}}
|
||||
{{- end -}}
|
||||
</td>
|
||||
</tr>
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
</tbody>
|
||||
</table>
|
||||
</section>
|
|
@ -0,0 +1,10 @@
|
|||
{{ $titles := ( slice ) }}
|
||||
|
||||
{{ range . }}
|
||||
{{ $titles = $titles | append (slice ( .Title | plainify ) ) }}
|
||||
{{ if .Sections }}
|
||||
{{ $titles = $titles | append ( partial "cv/organisations/recursive-children-titles.html" .Sections ) }}
|
||||
{{ end }}
|
||||
{{ end }}
|
||||
|
||||
{{ return $titles }}
|
18
layouts/_partials/cv/organisations/recursive-children.html
Normal file
18
layouts/_partials/cv/organisations/recursive-children.html
Normal file
|
@ -0,0 +1,18 @@
|
|||
{{- if ( not ( and ( .Params.redact ) ( ne $.Site.Params.redact "show" ) ) ) -}}
|
||||
<li class="hierarchy-item hierarchy-item--child">
|
||||
{{- if ( and ( .Params.redact ) ( ne $.Site.Params.redact "show" ) ) -}}
|
||||
{{- if ( eq $.Site.Params.redact "black" ) -}}
|
||||
{{- partialCached "redact-black.html" . -}}
|
||||
{{- end -}}
|
||||
{{- else -}}
|
||||
<a href="{{- .RelPermalink -}}">
|
||||
{{- default .Title .Params.markup_title | .Page.RenderString -}}
|
||||
</a>
|
||||
{{- range .Sections -}}
|
||||
<ul>
|
||||
{{- partial "cv/organisations/recursive-children.html" . -}}
|
||||
</ul>
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
</li>
|
||||
{{- end -}}
|
12
layouts/_partials/cv/organisations/recursive-parents.html
Normal file
12
layouts/_partials/cv/organisations/recursive-parents.html
Normal file
|
@ -0,0 +1,12 @@
|
|||
<!--. is .c-->
|
||||
<!--$ is .g-->
|
||||
|
||||
{{ $scratch := .g.Scratch }}
|
||||
{{ if .c.Parent }}
|
||||
{{ if ne .c.Parent.Type "cv/organisations" }}
|
||||
{{ with .c.Parent }}
|
||||
{{ $scratch.Add "parents" ( slice . ) }}
|
||||
{{ partial "cv/organisations/recursive-parents.html" (dict "c" . "g" $.g ) }}
|
||||
{{ end }}
|
||||
{{ end }}
|
||||
{{ end }}
|
9
layouts/_partials/cv/organisations/reverse-slice.html
Normal file
9
layouts/_partials/cv/organisations/reverse-slice.html
Normal file
|
@ -0,0 +1,9 @@
|
|||
<!-- Source: https://discourse.gohugo.io/t/reverse-array/28753/2 -->
|
||||
|
||||
{{- $sliceOriginal := . -}}
|
||||
{{- $len := len $sliceOriginal -}}
|
||||
{{- $sliceReversed := slice -}}
|
||||
{{- range seq $len -}}
|
||||
{{- $sliceReversed = $sliceReversed | append (index $sliceOriginal (sub $len .)) }}
|
||||
{{- end -}}
|
||||
{{- return $sliceReversed -}}
|
14
layouts/_partials/cv/timeline-legend.html
Normal file
14
layouts/_partials/cv/timeline-legend.html
Normal file
|
@ -0,0 +1,14 @@
|
|||
<aside class="timeline__legend">
|
||||
<fieldset id="legend__past">
|
||||
<legend class="label">Past</legend>
|
||||
|
||||
<button id="past-unpaid" class="button legend__button"><p><span class="colour-square colour-square--unpaid-past"></span> Unpaid</p></button>
|
||||
<button id="past-paid" class="button legend__button"><p><span class="colour-square colour-square--paid-past"></span> Paid</p></button>
|
||||
</fieldset>
|
||||
<fieldset id="legend__current">
|
||||
<legend class="label">Current</legend>
|
||||
|
||||
<button id="current-unpaid" class="button legend__button"><p><span class="colour-square colour-square--unpaid-current"></span> Unpaid</p></button>
|
||||
<button id="current-paid" class="button legend__button"><p><span class="colour-square colour-square--paid-current"></span> Paid</p></button>
|
||||
</fieldset>
|
||||
</aside>
|
40
layouts/_partials/footer/text.html
Normal file
40
layouts/_partials/footer/text.html
Normal file
|
@ -0,0 +1,40 @@
|
|||
{{- /*
|
||||
Returns the site footer text.
|
||||
|
||||
@params licences_data Site data of licences, indexed by SPDX IDs.
|
||||
@params licence Licence identifier.
|
||||
@params licence_link Manually-defined licence URL. Optional.
|
||||
*/
|
||||
-}}
|
||||
|
||||
<!-- Validation -->
|
||||
|
||||
{{- if ( not ( isset . "author_name" ) ) -}}
|
||||
{{- errorf "No site author defined" -}}
|
||||
{{- end -}}
|
||||
|
||||
{{- if ( not ( isset . "report_issue_url" ) ) -}}
|
||||
{{- errorf "No 'Report Issue' URL defined" -}}
|
||||
{{- end -}}
|
||||
|
||||
{{- if ( not ( isset . "privacy_policy_url" ) ) -}}
|
||||
{{- errorf "No 'Privacy Policy' URL defined" -}}
|
||||
{{- end -}}
|
||||
|
||||
{{- if ( not ( isset . "sitemap_path" ) ) -}}
|
||||
{{- errorf "No sitemap path defined" -}}
|
||||
{{- end -}}
|
||||
|
||||
{{- if ( not ( isset . "last_build_time" ) ) -}}
|
||||
{{- errorf "No last build time defined" -}}
|
||||
{{- end -}}
|
||||
|
||||
<!-- Rendering -->
|
||||
|
||||
<p>
|
||||
By <a href="/">{{- .author_name -}}</a> |
|
||||
<a href="{{- .report_issue_url -}}">Report an Issue</a> |
|
||||
<a href="{{- .privacy_policy_url -}}">Privacy Policy</a> |
|
||||
<a href="{{- .sitemap_path -}}">Sitemap</a> |
|
||||
Built: {{ .last_build_time -}}
|
||||
</p>
|
7
layouts/_partials/get_all_organisations.html
Normal file
7
layouts/_partials/get_all_organisations.html
Normal file
|
@ -0,0 +1,7 @@
|
|||
{{ $organisations := slice }}
|
||||
{{ range .Site.Pages }}
|
||||
{{ if .IsDescendant ( .GetPage "cv/organisations" ) }}
|
||||
{{ $organisations = $organisations | append . }}
|
||||
{{ end }}
|
||||
{{ end }}
|
||||
{{ return $organisations }}
|
9
layouts/_partials/head/math.html
Normal file
9
layouts/_partials/head/math.html
Normal file
|
@ -0,0 +1,9 @@
|
|||
<script id="MathJax-script" async src="/js/mathjax/tex-chtml.js"></script>
|
||||
<script>
|
||||
MathJax = {
|
||||
tex: {
|
||||
displayMath: [['\\[', '\\]'], ['$$', '$$']], // block
|
||||
inlineMath: [['\\(', '\\)']] // inline
|
||||
}
|
||||
};
|
||||
</script>
|
17
layouts/_partials/head/meta.html
Normal file
17
layouts/_partials/head/meta.html
Normal file
|
@ -0,0 +1,17 @@
|
|||
<meta charset="utf-8" />
|
||||
<meta
|
||||
name="viewport"
|
||||
content="width=device-width, initial-scale=1"
|
||||
/>
|
||||
<meta
|
||||
name="robots"
|
||||
content="noindex"
|
||||
/>
|
||||
<meta
|
||||
name="theme-color"
|
||||
content="#FFFFF0"
|
||||
/>
|
||||
<meta
|
||||
name="twitter:dnt"
|
||||
content="on"
|
||||
/>
|
54
layouts/_partials/head/references.html
Normal file
54
layouts/_partials/head/references.html
Normal file
|
@ -0,0 +1,54 @@
|
|||
{{- /*
|
||||
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 -->
|
||||
|
||||
<link
|
||||
rel="license"
|
||||
href="{{- partialCached "util/get_licence_link.html" ( dict "licences_data" .sc.Site.Data.licences "licence" .sc.Site.Params.licence "licence_link" .sc.Site.Params.licence_link ) -}}"
|
||||
/>
|
||||
<link
|
||||
class="u-url u-uid"
|
||||
rel="me"
|
||||
href="{{- .sc.Site.Home.Permalink -}}"
|
||||
/>
|
||||
<link
|
||||
class="u-email"
|
||||
rel="me"
|
||||
href="mailto:{{- .sc.Site.Params.author.email -}}"
|
||||
/>
|
||||
{{- range .sc.Site.Params.meLinks -}}
|
||||
<link
|
||||
class="u-url"
|
||||
rel="me"
|
||||
href="{{ . }}"
|
||||
/>
|
||||
{{- end -}}
|
||||
<link
|
||||
class="u-logo"
|
||||
rel="icon"
|
||||
sizes="192x192"
|
||||
href="/images/icon.png"
|
||||
/>
|
||||
{{- with .sc.Site.Params.keyfile -}}
|
||||
<link
|
||||
class="u-key"
|
||||
rel="author"
|
||||
href="{{- . -}}"
|
||||
/>
|
||||
{{- end -}}
|
31
layouts/_partials/head/stylesheets.html
Normal file
31
layouts/_partials/head/stylesheets.html
Normal file
|
@ -0,0 +1,31 @@
|
|||
{{- /*
|
||||
References site stylesheets.
|
||||
*/
|
||||
-}}
|
||||
|
||||
<link
|
||||
href="/css/sanitize.css"
|
||||
rel="stylesheet"
|
||||
/>
|
||||
{{- $mainStylesheet := resources.Get "css/main.scss" }}
|
||||
{{- $mainStylesheet := $mainStylesheet | css.Sass | resources.Fingerprint }}
|
||||
<link
|
||||
rel="stylesheet"
|
||||
type="text/css"
|
||||
href="{{ $mainStylesheet.Permalink }}"
|
||||
integrity="{{ $mainStylesheet.Data.Integrity | html }}"
|
||||
/>
|
||||
{{- $printStylesheet := resources.Get "css/print.scss" }}
|
||||
{{- $printStylesheet := $printStylesheet | css.Sass | resources.Fingerprint }}
|
||||
<link
|
||||
rel="stylesheet"
|
||||
media="print"
|
||||
href="{{ $printStylesheet.Permalink }}"
|
||||
integrity="{{ $printStylesheet.Data.Integrity | html }}"
|
||||
/>
|
||||
{{- $feedsStylesheet := resources.Get "css/feeds.scss" }}
|
||||
{{- $feedsStylesheet := $feedsStylesheet | css.Sass }}
|
||||
<link
|
||||
rel="stylesheet"
|
||||
href="{{ $feedsStylesheet.Permalink }}"
|
||||
/>
|
18
layouts/_partials/head/title.html
Normal file
18
layouts/_partials/head/title.html
Normal file
|
@ -0,0 +1,18 @@
|
|||
{{- /*
|
||||
Renders the page title.
|
||||
|
||||
@params . Slice of title sections.
|
||||
*/
|
||||
-}}
|
||||
|
||||
<!-- Validation -->
|
||||
|
||||
{{- if ( not ( ge ( len . ) 1 ) ) -}}
|
||||
{{- errorf "No site title received" -}}
|
||||
{{- end -}}
|
||||
|
||||
<!-- Rendering -->
|
||||
|
||||
<title itemprop="name">
|
||||
{{- delimit . " | " -}}
|
||||
</title>
|
5
layouts/_partials/header-tile.html
Normal file
5
layouts/_partials/header-tile.html
Normal file
|
@ -0,0 +1,5 @@
|
|||
<div class="item-tile item-tile--heading" id="items-{{ .Key }}">
|
||||
<header class="item-tile__header">
|
||||
<h2 class="item-tile__title">{{ .Key }}</h2>
|
||||
</header>
|
||||
</div>
|
64
layouts/_partials/header/site-header.html
Normal file
64
layouts/_partials/header/site-header.html
Normal file
|
@ -0,0 +1,64 @@
|
|||
<header class="site-header h-card">
|
||||
{{ block "header" . }}
|
||||
<h2
|
||||
class="p-name site-header__title"
|
||||
itemprop="name"
|
||||
>
|
||||
<a
|
||||
class="u-url"
|
||||
href="{{ .Site.Home.RelPermalink }}"
|
||||
rel="me author"
|
||||
>{{ .Site.Title }}</a
|
||||
>
|
||||
</h2>
|
||||
<p
|
||||
class="p-note site-header__tagline"
|
||||
itemprop="about"
|
||||
>
|
||||
Views my own. Discussion ≠ endorsement. Do try this at home.
|
||||
</p>
|
||||
<p class="site-header__icons">
|
||||
~
|
||||
<a
|
||||
class="u-email"
|
||||
aria-label="Email"
|
||||
href="mailto:{{ $.Site.Params.adminEmail }}"
|
||||
rel="me"
|
||||
>✉️</a
|
||||
>
|
||||
~
|
||||
<a
|
||||
class="u-url"
|
||||
aria-label="Code Forge"
|
||||
href="{{ .Site.Params.codeURL }}"
|
||||
rel="me"
|
||||
>🧑💻</a
|
||||
>
|
||||
~
|
||||
<a
|
||||
class="u-key"
|
||||
aria-label="PGP key"
|
||||
href="/{{ .Site.Params.keyfile }}"
|
||||
rel="me"
|
||||
>🔐</a
|
||||
>
|
||||
~
|
||||
<a
|
||||
href="/index.xml"
|
||||
aria-label="{{ .Site.Title }} RSS feed"
|
||||
><img
|
||||
class="feed-icon"
|
||||
alt="RSS feed"
|
||||
src="{{ .Site.Params.feedIcon }}"
|
||||
/></a>
|
||||
~
|
||||
</p>
|
||||
<nav class="site-header__nav">
|
||||
<ul>
|
||||
{{ range ( where .Site.Sections.ByTitle "Type" "in" site.Params.mainSections ) }}
|
||||
<li><a href="{{ .RelPermalink }}">{{ .Title | safeHTML }}</a></li>
|
||||
{{ end }}
|
||||
</ul>
|
||||
</nav>
|
||||
{{ end }}
|
||||
</header>
|
62
layouts/_partials/images/get-image.html
Normal file
62
layouts/_partials/images/get-image.html
Normal file
|
@ -0,0 +1,62 @@
|
|||
<!--
|
||||
Renders an image, resizing it if valid.
|
||||
|
||||
@params img The image.
|
||||
@params size The resize target. Optional.
|
||||
@params format Image conversation format. Optional.
|
||||
-->
|
||||
|
||||
<!-- Variable assignment -->
|
||||
|
||||
{{- $img := .img -}}
|
||||
{{- $hint := default ( index $img.Params "hint" ) "" }}
|
||||
{{- $size := cond ( isset . "size" ) .size "" }}
|
||||
{{- $isResizable := not ( in ( slice "avif" "svg" "gif" ) $img.MediaType.SubType ) -}}
|
||||
{{- $format := cond ( isset . "format" ) .format "webp" }}
|
||||
|
||||
{{- $permalink := "" -}}
|
||||
|
||||
<!-- Validation -->
|
||||
|
||||
{{- if ( not ( isset . "img" ) ) -}}
|
||||
{{- errorf "No img set" -}}
|
||||
{{- end -}}
|
||||
|
||||
{{- if ne .img.MediaType.MainType "image" -}}
|
||||
{{- errorf "Image '%q' is not an image" .img }}
|
||||
{{- end -}}
|
||||
|
||||
{{- if ( isset . "size" ) -}}
|
||||
{{- if $isResizable -}}
|
||||
{{- $width := ( first 1 ( split .size "x" ) ) -}}
|
||||
{{- if gt $width $img.Width -}}
|
||||
{{- warnf "Requested size %s is more than image width %d (%q)" $width $img.Width $img.File.Path -}}
|
||||
{{- end -}}
|
||||
{{- else -}}
|
||||
{{- warnf "Size set on non-resizable image of type %s; ignoring" $img.MediaType.SubType -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
|
||||
<!-- Rendering -->
|
||||
|
||||
{{- if $isResizable -}}
|
||||
{{- if $size -}}
|
||||
{{- if eq $size "same" -}}
|
||||
{{- $permalink = ( $img.Process ( printf "%s %s" $format $hint ) ).RelPermalink -}}
|
||||
{{- else -}}
|
||||
{{- $permalink = ( $img.Resize ( printf "%s %s %s" $size $format $hint ) ).RelPermalink -}}
|
||||
{{- end -}}
|
||||
{{- else -}}
|
||||
{{- if gt $img.Width 1200 -}}
|
||||
{{- $permalink = ( $img.Resize ( printf "1200x %s %s" $format $hint ) ).RelPermalink -}}
|
||||
{{- else if gt $img.Width 800 -}}
|
||||
{{- $permalink = ( $img.Resize ( printf "800x %s %s" $format $hint ) ).RelPermalink -}}
|
||||
{{- else -}}
|
||||
{{- $permalink = ( $img.Process ( printf "%s %s" $format $hint ) ).RelPermalink -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
{{- else }}
|
||||
{{- $permalink = $img.RelPermalink -}}
|
||||
{{- end -}}
|
||||
|
||||
{{- return $permalink -}}
|
100
layouts/_partials/item-tile.html
Normal file
100
layouts/_partials/item-tile.html
Normal file
|
@ -0,0 +1,100 @@
|
|||
{{- if ( and ( .Params.redact ) ( ne $.Site.Params.redact "show" ) ) -}}
|
||||
{{- if ( eq $.Site.Params.redact "black" ) -}}
|
||||
<article class="item-tile item-tile--redacted {{- with .Params.site }}item-tile--{{ . }}{{ end -}}">
|
||||
<header class="item-tile__header">
|
||||
<h2
|
||||
class="p-name item-tile__title{{ if gt ( len ( .Title | plainify ) ) 40 }}item-tile__title--long{{ end }}"
|
||||
itemprop="name"
|
||||
>
|
||||
{{- partialCached "redact-black.html" . -}}
|
||||
</h2>
|
||||
<p style="display: none;">
|
||||
Published:
|
||||
<time
|
||||
class="dt-published"
|
||||
itemprop="datePublished"
|
||||
datetime="{{ .PublishDate | time.Format "2006-01-02T15:04:05-07:00" }}"
|
||||
>{{ .PublishDate | time.Format "2006-01-02T15:04:05-07:00" }}</time
|
||||
>
|
||||
</p>
|
||||
</header>
|
||||
</article>
|
||||
{{- end -}}
|
||||
{{- else -}}
|
||||
<a
|
||||
id="{{ .Title | urlize }}"
|
||||
class="h-entry u-url link--tile"
|
||||
href="{{ .RelPermalink }}"
|
||||
itemprop="blogPost"
|
||||
itemscope
|
||||
itemtype="https://schema.org/BlogPosting"
|
||||
>
|
||||
<article
|
||||
class="item-tile lazy {{- with .Params.site }}item-tile--{{ . }}{{ end -}}"
|
||||
{{ if .Params.featured_image }}
|
||||
style="background-image: url(
|
||||
{{ with .Resources.GetMatch .Params.featured_image }}
|
||||
{{- partialCached "images/get-image.html" ( dict "img" . "size" "500x" ) ( printf "%s-500x" .Title ) -}}
|
||||
{{- else -}}
|
||||
{{- warnf "Featured image %s is not a page resource" .Params.featured_image -}}
|
||||
{{- .Params.featured_image -}}
|
||||
{{- end -}}
|
||||
)"
|
||||
{{ end }}
|
||||
>
|
||||
{{ if .Params.featured_image -}}
|
||||
<img
|
||||
class="u-photo"
|
||||
style="display: none;"
|
||||
src="
|
||||
{{- with .Resources.GetMatch .Params.featured_image -}}
|
||||
{{- partialCached "images/get-image.html" ( dict "img" . "size" "500x" ) ( printf "%s-500x" .Title ) -}}
|
||||
{{- else -}}
|
||||
{{- warnf "Featured image %s is not a page resource" .Params.featured_image -}}
|
||||
{{- .Params.featured_image -}}
|
||||
{{ end }}
|
||||
"
|
||||
alt="
|
||||
{{- with .Resources.GetMatch .Params.featured_image -}}
|
||||
{{- .Params.alt -}}
|
||||
{{- end -}}
|
||||
"
|
||||
/>
|
||||
{{- end }}
|
||||
<header class="item-tile__header item-tile__title-wrapper">
|
||||
{{ if ( or .Params.series .Params.published_in ) }}
|
||||
<span
|
||||
class="item-tile__banner item-tile__banner--{{ if .Params.series -}}
|
||||
series
|
||||
{{- else if .Params.published_in -}}
|
||||
published-in
|
||||
{{- end }}"
|
||||
>
|
||||
{{- if .Params.series -}}
|
||||
{{ .Params.series | safeHTML }}
|
||||
{{- else if .Params.published_in -}}
|
||||
{{ .Params.published_in | .Page.RenderString | safeHTML }}
|
||||
{{- end -}}
|
||||
</span>
|
||||
{{ end }}
|
||||
|
||||
{{- if .File -}}
|
||||
{{- partial "text/item-title.html" ( dict "pc" . "sc" $ "class" "item-tile" ) -}}
|
||||
{{- else -}}
|
||||
{{- partial "text/item-title.html" ( dict "pc" . "sc" $ "class" "item-tile" ) -}}
|
||||
{{- end -}}
|
||||
|
||||
|
||||
<p style="display: none;">
|
||||
Published:
|
||||
<time
|
||||
class="dt-published"
|
||||
itemprop="datePublished"
|
||||
datetime="{{ .PublishDate | time.Format "2006-01-02T15:04:05-07:00" }}"
|
||||
>{{ .PublishDate | time.Format "2006-01-02T15:04:05-07:00" }}</time
|
||||
>
|
||||
</p>
|
||||
</header>
|
||||
</article>
|
||||
</a>
|
||||
{{- end -}}
|
12
layouts/_partials/items-grid.html
Normal file
12
layouts/_partials/items-grid.html
Normal file
|
@ -0,0 +1,12 @@
|
|||
<section class="site-content__body">
|
||||
{{ range ( ( where ( where .Pages "Draft" false ) "Params.redact" "ne" true ).GroupByPublishDate "2006" ) }}
|
||||
{{ if ( not ( eq .Key "0001" ) ) }}
|
||||
{{ partialCached "header-tile.html" . .Key }}
|
||||
{{ range .Pages }}
|
||||
{{ if ( not ( .IsDescendant ( .GetPage "/cv/roles" ) ) ) }}
|
||||
{{ partialCached "item-tile.html" . . }}
|
||||
{{ end }}
|
||||
{{ end }}
|
||||
{{ end }}
|
||||
{{ end }}
|
||||
</section>
|
62
layouts/_partials/media/attr.html
Normal file
62
layouts/_partials/media/attr.html
Normal file
|
@ -0,0 +1,62 @@
|
|||
<!--
|
||||
Partial to render attribution for a resource.
|
||||
|
||||
@params sc Site context.
|
||||
@params pc Page context.
|
||||
@params attr Resource attribution.
|
||||
@params attr_link Resource link. Optional.
|
||||
@params attr_license Resource license. Optional.
|
||||
@params attr_license_link Resource license link. Optional.
|
||||
-->
|
||||
|
||||
<!-- 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 ( isset . "params" ) ) -}}
|
||||
{{- errorf "No params given (%q)" .pc.File.Path -}}
|
||||
{{- end -}}
|
||||
|
||||
{{- if ( not ( isset .params "attr" ) ) -}}
|
||||
{{- errorf "No attr given (%q)" .pc.File.Path -}}
|
||||
{{- end -}}
|
||||
|
||||
<!-- Variable assignment -->
|
||||
|
||||
{{- $attr := .params.attr -}}
|
||||
{{- $attr_link := .params.attrlink -}}
|
||||
{{- $attr_licence := .params.attrlicence -}}
|
||||
{{- $attr_licence_link := .params.attrlicencelink -}}
|
||||
|
||||
<!-- Rendering -->
|
||||
|
||||
<p class="attr">
|
||||
{{- with $attr_link -}}
|
||||
<a href="{{ . }}" target="_blank" rel="noopener">
|
||||
{{- end -}}
|
||||
{{- $attr | safeHTML -}}
|
||||
{{- if $attr_link -}}
|
||||
</a>
|
||||
{{- end -}}
|
||||
|
||||
{{- if $attr_licence }} (
|
||||
{{- $attr_licence_link := partialCached "util/get_licence_link.html" ( dict "licences_data" .sc.Site.Data.licences "licence" $attr_licence "licence_link" $attr_licence_link ) $attr_licence $attr_licence_link -}}
|
||||
|
||||
{{- with $attr_licence_link -}}
|
||||
<a href="{{- . -}}" target="_blank" rel="noopener">
|
||||
{{- end -}}
|
||||
|
||||
{{- $attr_licence -}}
|
||||
|
||||
{{- with $attr_licence_link -}}
|
||||
</a>
|
||||
{{- end -}}
|
||||
)
|
||||
{{- end -}}
|
||||
<p>
|
12
layouts/_partials/media/audio.html
Normal file
12
layouts/_partials/media/audio.html
Normal file
|
@ -0,0 +1,12 @@
|
|||
<!--
|
||||
Render an audio track in an interactive player.
|
||||
|
||||
@params context The audio media file.
|
||||
-->
|
||||
|
||||
{{- $src := . -}}
|
||||
|
||||
<audio class="u-audio figure__audio" itemprop="audio" controls>
|
||||
<source src="{{ $src.RelPermalink }}" type="{{ $src.MediaType }}" />
|
||||
<p>Your browser doesn't support embedded audio, <a href="{{ $src.RelPermalink }}">view the audio here</a>.</p>
|
||||
</audio>
|
53
layouts/_partials/media/picture.html
Normal file
53
layouts/_partials/media/picture.html
Normal file
|
@ -0,0 +1,53 @@
|
|||
<!--
|
||||
Render an image in a context-appropriate format and size.
|
||||
|
||||
@params src Image media file.
|
||||
@params raw Force raw image only. Optional.
|
||||
-->
|
||||
|
||||
<!-- Variable assignment -->
|
||||
|
||||
{{- $src := .src -}}
|
||||
{{- $hint := default ( index $src.Params "hint" ) "" }}
|
||||
{{- $format := cond ( and ( isset . "raw" ) .raw ) "" "webp" -}}
|
||||
{{- $isResizable := not ( in ( slice "svg" "gif" ) $src.MediaType.SubType ) -}}
|
||||
|
||||
|
||||
<!-- Rendering -->
|
||||
|
||||
<picture
|
||||
class="picture"
|
||||
itemprop="image"
|
||||
>
|
||||
{{ if $isResizable -}}
|
||||
<source
|
||||
srcset="{{- partialCached "images/get-image.html" ( dict "img" $src "size" "same" "format" $format ) $src.Title -}}"
|
||||
/>
|
||||
{{- if gt $src.Width 1200 -}}
|
||||
<source
|
||||
srcset="{{- partialCached "images/get-image.html" ( dict "img" $src "size" "1200x" "format" $format ) ( printf "%s-1200x" $src.Title ) -}}"
|
||||
media="(max-width: 1200px)"
|
||||
/>
|
||||
{{- end -}}
|
||||
{{- if gt $src.Width 800 -}}
|
||||
<source
|
||||
srcset="{{- partialCached "images/get-image.html" ( dict "img" $src "size" "800x" "format" $format ) ( printf "%s-800x" $src.Title ) -}}"
|
||||
media="(max-width: 800px)"
|
||||
/>
|
||||
{{- end -}}
|
||||
{{- end }}
|
||||
<img
|
||||
class="u-photo picture__image"
|
||||
{{ if not $isResizable -}}
|
||||
src="{{- $src.RelPermalink -}}"
|
||||
{{- else -}}
|
||||
src="{{- partialCached "images/get-image.html" ( dict "img" $src "format" $format ) $src.Title -}}"
|
||||
width="{{- $src.Width -}}"
|
||||
height="{{- $src.Height -}}"
|
||||
{{- end }}
|
||||
{{ with $src.Params.alt -}}alt="{{- . -}}"{{- end }}
|
||||
{{ with $src.Params.title -}}title="{{- . -}}"{{- end }}
|
||||
loading="lazy"
|
||||
role="img"
|
||||
/>
|
||||
</picture>
|
26
layouts/_partials/media/video.html
Normal file
26
layouts/_partials/media/video.html
Normal file
|
@ -0,0 +1,26 @@
|
|||
<!--
|
||||
Render a video in an interactive player.
|
||||
|
||||
@params context Video media file.
|
||||
@params page_file_path Filepath of the calling file for error messages.
|
||||
-->
|
||||
|
||||
{{- $src := .src -}}
|
||||
|
||||
<video
|
||||
class="u-video figure__video"
|
||||
controls
|
||||
itemprop="video"
|
||||
preload="none"
|
||||
src="{{ $src.RelPermalink }}"
|
||||
poster="
|
||||
{{- if $src.Params.poster -}}
|
||||
{{- $posterSrc := $.Page.Resources.GetMatch ( .Get $src.Params.poster ) -}}
|
||||
{{- partialCached "images/get-image.html" ( dict "img" $posterSrc ) $posterSrc.Title -}}
|
||||
{{- else -}}
|
||||
{{- erroridf "a11y-video-poster" "No poster defined for resource %q (%q)" $src.RelPermalink .page_file_path -}}
|
||||
{{- end -}}
|
||||
"
|
||||
>
|
||||
Your browser doesn't support embedded video, <a href="{{ $src.RelPermalink }}">view the video here</a>.
|
||||
</video>
|
1
layouts/_partials/redact-black.html
Normal file
1
layouts/_partials/redact-black.html
Normal file
|
@ -0,0 +1 @@
|
|||
███████████
|
30
layouts/_partials/scripts/charts.js
Normal file
30
layouts/_partials/scripts/charts.js
Normal file
|
@ -0,0 +1,30 @@
|
|||
{{- /*
|
||||
Renders charts on a post.
|
||||
|
||||
@params . Chart JS config script.
|
||||
*/
|
||||
-}}
|
||||
|
||||
<!-- Validation -->
|
||||
|
||||
{{- if ( not . ) -}}
|
||||
{{- errorf "No config JS defined" -}}
|
||||
{{- end -}}
|
||||
|
||||
<!-- Variable Assignment -->
|
||||
|
||||
{{- $chartsConfigJS := . -}}
|
||||
|
||||
<!-- Rendering -->
|
||||
|
||||
<script
|
||||
id="Charts-script"
|
||||
src="/js/chart/chart.js"
|
||||
></script>
|
||||
<script src="/js/chartjs-plugin-annotation/dist/chartjs-plugin-annotation.min.js"></script>
|
||||
<script src="https://cdn.jsdelivr.net/npm/chartjs-adapter-date-fns/dist/chartjs-adapter-date-fns.bundle.min.js"></script>
|
||||
<script
|
||||
id="Charts-config-script"
|
||||
src="{{ $chartsConfigJS.Permalink }}"
|
||||
integrity="{{ $chartsConfigJS.Data.Integrity }}"
|
||||
></script>
|
46
layouts/_partials/scripts/show_post_locations_on_map.js
Normal file
46
layouts/_partials/scripts/show_post_locations_on_map.js
Normal file
|
@ -0,0 +1,46 @@
|
|||
{{- /*
|
||||
Renders a post's locations on a map.
|
||||
|
||||
@params pc Page context.
|
||||
@params locations_data Site data of locations.
|
||||
@params locations Post locations.
|
||||
*/
|
||||
-}}
|
||||
|
||||
<!-- Validation -->
|
||||
|
||||
{{- if ( not ( isset . "pc" ) ) -}}
|
||||
{{- errorf "No page context passed" -}}
|
||||
{{- end -}}
|
||||
|
||||
{{- if ( not ( isset . "locations_data" ) ) -}}
|
||||
{{- errorf "No location site data defined" -}}
|
||||
{{- end -}}
|
||||
|
||||
{{- if ( not ( isset . "locations" ) ) -}}
|
||||
{{- errorf "No post locations defined" -}}
|
||||
{{- end -}}
|
||||
|
||||
<!-- Rendering -->
|
||||
|
||||
<script>
|
||||
var map = L.map('map').setView([55, -3], 13);
|
||||
|
||||
L.tileLayer('https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', {
|
||||
maxZoom: 19,
|
||||
attribution: '© <a href="https://www.openstreetmap.org/copyright">OpenStreetMap</a>'
|
||||
}).addTo(map);
|
||||
|
||||
var latLons = [];
|
||||
{{ $locations_leaf_nodes := partialCached "util/get_location_leaf_nodes.html" .locations_data -}}
|
||||
{{- range .locations -}}
|
||||
{{- with ( index $locations_leaf_nodes ( replaceRE `, [A-Z]+` "" . ) ) -}}
|
||||
L.marker([{{ .lat }}, {{ .lon }}]).addTo(map);
|
||||
latLons.push([{{ .lat }}, {{ .lon }}]);
|
||||
{{- else -}}
|
||||
{{- erroridf "missing-lat-lon" "Could not find lat-lon for %q" . -}}
|
||||
{{- end -}}
|
||||
{{- end }}
|
||||
|
||||
map.fitBounds(latLons);
|
||||
</script>
|
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>
|
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
|
||||
>
|
21
layouts/_partials/text/item-title.html
Normal file
21
layouts/_partials/text/item-title.html
Normal file
|
@ -0,0 +1,21 @@
|
|||
{{- /*
|
||||
Displays an itemtitle with optional subtitle.
|
||||
|
||||
@params pc Page context.
|
||||
@params sc Site context.
|
||||
@params class The base of the element CSS class.
|
||||
*/
|
||||
-}}
|
||||
|
||||
|
||||
<hgroup
|
||||
class="p-name"
|
||||
itemprop="name"
|
||||
>
|
||||
<h2 class="{{ .class }}__title {{ if gt ( len ( .pc.Title | plainify ) ) 40 }}{{ .class }}__title--long{{ end }}">
|
||||
{{- default .pc.Title .pc.Params.markup_title | .pc.Page.RenderString -}}
|
||||
</h2>
|
||||
{{ with .pc.Params.subtitle }}
|
||||
<p class="{{ $.class }}__subtitle">{{ . | $.pc.Page.RenderString }}</p>
|
||||
{{ end }}
|
||||
</hgroup>
|
11
layouts/_partials/util/get_content_by_section.html
Normal file
11
layouts/_partials/util/get_content_by_section.html
Normal file
|
@ -0,0 +1,11 @@
|
|||
<!--
|
||||
Given a top-level section title slug [blog|cv|portfolio], returns all
|
||||
`Pages` within that top-level section.
|
||||
|
||||
@param sc The site content (`$`)
|
||||
@param section_slug The slug of the section to use [blog|cv|portfolio]
|
||||
|
||||
@returns Pages|nil
|
||||
-->
|
||||
|
||||
{{- where ( ( .sc.GetPage "cv" ).Sections ) "Title" .section_title -}}
|
46
layouts/_partials/util/get_licence_link.html
Normal file
46
layouts/_partials/util/get_licence_link.html
Normal file
|
@ -0,0 +1,46 @@
|
|||
{{- /*
|
||||
Returns the URL for a given licence, either from the site data or from a defined URL.
|
||||
|
||||
@params licences_data Site data of licences, indexed by SPDX IDs.
|
||||
@params licence Licence identifier.
|
||||
@params licence_link Manually-defined licence URL. Optional.
|
||||
*/
|
||||
-}}
|
||||
|
||||
<!-- Validation -->
|
||||
|
||||
{{- if ( not ( isset . "licences_data" ) ) -}}
|
||||
{{- errorf "No licence data passed to partial" -}}
|
||||
{{- end -}}
|
||||
|
||||
{{- if ( not ( isset . "licence" ) ) -}}
|
||||
{{- errorf "No licence requested in partial" -}}
|
||||
{{- end -}}
|
||||
|
||||
<!-- Variable assignment -->
|
||||
|
||||
{{- $licences_data := .licences_data -}}
|
||||
{{- $licence := .licence -}}
|
||||
{{- $licence_link := .licence_link -}}
|
||||
|
||||
{{- $final_licence_link := "" -}}
|
||||
|
||||
<!-- Rendering -->
|
||||
|
||||
{{- if ( index $licences_data $licence ) -}}
|
||||
{{- if eq ( index $licences_data $licence ) $licence_link -}}
|
||||
{{- warnf "Redundant license link '%s' defined, it already exists in the site data" ( index $licences_data $licence ) -}}
|
||||
{{- $final_licence_link = ( index $licences_data $licence ) -}}
|
||||
{{- else -}}
|
||||
{{- if ( and ( $licence_link ) ( not ( eq ( index $licences_data $licence ) $licence_link ) ) ) -}}
|
||||
{{- warnf "Licence '%s' has a different link ('%s') defined in the site data, using '%s' instead" $licence ( index $licences_data $licence ) $licence_link -}}
|
||||
{{- end -}}
|
||||
{{- $final_licence_link = $licence_link -}}
|
||||
{{- end -}}
|
||||
|
||||
{{- else if $licence_link -}}
|
||||
{{- warnidf "licence-link-not-in-site-data" "License link '%s' for licence '%s' should be in the site data, unless it's rarely used" $licence_link $licence -}}
|
||||
{{- $final_licence_link = $licence_link -}}
|
||||
{{- end -}}
|
||||
|
||||
{{- return $final_licence_link -}}
|
14
layouts/_partials/util/get_location_by_index.html
Normal file
14
layouts/_partials/util/get_location_by_index.html
Normal file
|
@ -0,0 +1,14 @@
|
|||
{{- $locations := .Params.location }}
|
||||
{{- $location := .Params.location }}
|
||||
|
||||
{{- range $k, $v := $locations -}}
|
||||
{{- if ( isset $v "lat" ) -}}
|
||||
{{- partialCached "util/get_location_by_index.html" ( dict "locations" $v "location" $location ) $location -}}
|
||||
{{- else if ( eq $k $location ) -}}
|
||||
{{- with $v -}}
|
||||
{{- return . -}}
|
||||
{{- else -}}
|
||||
{{- warnf "Location %q has no co-ordinates set" $k -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
20
layouts/_partials/util/get_location_leaf_nodes.html
Normal file
20
layouts/_partials/util/get_location_leaf_nodes.html
Normal file
|
@ -0,0 +1,20 @@
|
|||
<!--
|
||||
Returns all locations from `data/locations.json`.
|
||||
|
||||
@params locations dict<dict>
|
||||
@returns dict<dict>
|
||||
-->
|
||||
|
||||
{{- $locations := ( dict ) -}}
|
||||
|
||||
{{- range $k, $v := . -}}
|
||||
{{- if not ( isset $v "redact" ) -}}
|
||||
{{- if ( isset $v "lat" ) -}}
|
||||
{{- $locations = merge $locations ( dict $k $v ) -}}
|
||||
{{- else -}}
|
||||
{{- $locations = merge $locations ( partial "util/get_location_leaf_nodes.html" . ) -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
|
||||
{{- return $locations -}}
|
7
layouts/_partials/util/get_valid_rel_values.html
Normal file
7
layouts/_partials/util/get_valid_rel_values.html
Normal file
|
@ -0,0 +1,7 @@
|
|||
<!--
|
||||
Returns a list of valid values for the `rel` HTML attribute.
|
||||
|
||||
@returns slice
|
||||
-->
|
||||
|
||||
{{- return slice "alternate" "author" "external" "help" "license" "me" "next" "nofollow" "noopener" "noreferrer" "opener" "prev" "privacy-policy" "search" "tag" "terms-of-service" -}}
|
58
layouts/_partials/util/render_recursive_list.html
Normal file
58
layouts/_partials/util/render_recursive_list.html
Normal file
|
@ -0,0 +1,58 @@
|
|||
<!--
|
||||
Recursively render an ordered or unordered list from a set of arbitrarily-
|
||||
deeply-nested items.
|
||||
|
||||
@params sc Site context
|
||||
@params pc Page context
|
||||
@params items Set of items to render a list from.
|
||||
@params itemtype Schema.org type to apply. Optional.
|
||||
@params listType "unordered" or "ordered". Default "unordered".
|
||||
-->
|
||||
|
||||
<!-- Validation -->
|
||||
|
||||
{{- if not .sc.Site.Data.itemtypes -}}
|
||||
{{- errorf "Can't access site context in partial (%q)" .pc.File.Path -}}
|
||||
{{- end -}}
|
||||
|
||||
{{- if not .items -}}
|
||||
{{- warnf "No items passed to list partial (%q)" .pc.File.Path -}}
|
||||
{{- end -}}
|
||||
|
||||
{{- if ( and .itemtype ( not ( in .sc.Site.Data.itemtypes .itemtype ) ) ) -}}
|
||||
{{- erroridf "invalid-itemtype" "Invalid Schema.org type value %q (%q)" .itemtype .pc.File.Path -}}
|
||||
{{- end -}}
|
||||
|
||||
{{- if ( and .listType ( not ( in ( slice "unordered" "ordered" ) .listType ) ) ) -}}
|
||||
{{- erroridf "invalid-listType" "Invalid list type value %q (%q)" .listType .pc.File.Path -}}
|
||||
{{- end -}}
|
||||
|
||||
<!-- Default Assignment -->
|
||||
|
||||
{{- $itemtype := default "" .itemtype -}}
|
||||
{{- $listType := default "unordered" .listType -}}
|
||||
|
||||
<!-- Rendering -->
|
||||
|
||||
{{- if ( eq $listType "unordered" ) -}}
|
||||
<ul>
|
||||
{{- else -}}
|
||||
<ol>
|
||||
{{- end -}}
|
||||
|
||||
{{- range $k, $v := .items -}}
|
||||
{{- if not ( isset $v "redact" ) -}}
|
||||
<li itemscope itemtype="https://schema.org/Place">
|
||||
{{- $k -}}
|
||||
{{- if ( not ( isset $v "lat" ) ) -}}
|
||||
{{- partial "util/render_recursive_list.html" ( dict "sc" $.sc "pc" $.pc "items" $v "itemtype" $itemtype "listType" $listType ) -}}
|
||||
{{- end -}}
|
||||
</li>
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
|
||||
{{- if ( eq $listType "unordered" ) -}}
|
||||
</ul>
|
||||
{{- else -}}
|
||||
</ol>
|
||||
{{- end -}}
|
7
layouts/_partials/years-list.html
Normal file
7
layouts/_partials/years-list.html
Normal file
|
@ -0,0 +1,7 @@
|
|||
<ul class="minor-links__years">
|
||||
{{ range ( ( where .Pages "Draft" false ).GroupByDate "2006" ) }}
|
||||
{{ if ( not ( eq .Key "0001" ) ) }}
|
||||
<li><a href="#items-{{ .Key }}">{{ .Key }}</a></li>
|
||||
{{ end }}
|
||||
{{ end }}
|
||||
</ul>
|
Loading…
Add table
Add a link
Reference in a new issue