diff --git a/layouts/_default/single.html b/layouts/_default/single.html index 7f7c11a..24da06b 100644 --- a/layouts/_default/single.html +++ b/layouts/_default/single.html @@ -6,21 +6,31 @@ {{ define "header-scripts" }} {{ with .Params.locations }} - + {{ end }} {{ end }} {{ define "header-styles" }} {{ with .Params.styles }} - + {{ end }} {{ with .Params.locations }} - + {{ end }} {{ end }} {{ define "footer-scripts" }} - {{ with .Params.locations }} + {{ with .Params.locations }} - {{ end }} - {{ with .Params.scripts }} - {{ if in . "charts" }} - {{ $chartsConfigJS := $.Page.Resources.GetMatch "charts-init" | fingerprint }} - - - {{ end }} - {{ end }} + {{ end }} + {{ with .Params.scripts }} + {{ if in . "charts" }} + {{ $chartsConfigJS := $.Page.Resources.GetMatch "charts-init" | fingerprint }} + + + {{ end }} + {{ end }} {{ end }} {{ define "main-header" }} -
-
-
-

- {{ .Title | safeHTML }} -

- {{ with .Params.subtitle }} -

{{ . | safeHTML }}

- {{ end }} -
- {{ with .Resources.GetMatch .Params.featured_image }} -

- {{- if .Params.attrlink -}}{{- end -}} - {{- .Params.attr | safeHTML -}} - {{- if .Params.attrlink -}}{{- end -}} - {{- if .Params.attrlicence }} ( - {{- with .Params.attrlicencelink -}} - - {{- end -}} - {{- .Params.attrlicence -}} - {{- with .Params.attrlicencelink -}} - - {{- end -}} - ) - {{- end -}} -

- {{ end }} -
- -

~{{ .FuzzyWordCount | lang.FormatNumberCustom 0 }} words

-

Published:

-

Last modified: {{ .Lastmod.Format "January 2" }}{{ if in (slice 1 21 31) .Lastmod.Day}}st{{ else if in (slice 2 22) .Lastmod.Day}}nd{{ else if in (slice 3 23) .Lastmod.Day}}rd{{ else }}th{{ end }}, 1{{ .Lastmod.Format "2006" | lang.FormatNumberCustom 0 }} HE

- - {{ $post_age_in_years := math.Round ( div ( div ( now.Sub .PublishDate ).Hours 24 ) 365 ) }} - {{ if ( or .Params.site .Params.controversial ( gt $post_age_in_years 2 ) ) }} - - {{ end }} - - {{ if .Params.notes }} - - {{ end }} - - {{ if and ( .TableOfContents ) ( ne .TableOfContents "" ) }} - - {{ end }} -
+ {{ partial "single/main-header.html" ( dict "pc" . "sc" $ ) }} {{ end }} {{ define "main-body" }} @@ -128,37 +78,51 @@ {{- if ( or .Params.internal_links .Params.external_links ) -}}
{{- with .Params.internal_links -}} -

Internal Links

- - {{- end -}} - + {{- with .Params.external_links -}} -

External Links

- +

External Links

+ {{- end -}}
{{- end -}} - + {{ .Content }} {{ end }} {{ define "main-footer" }} -{{ partial "post-meta.html" . }} + {{ partial "single/post-meta.html" ( dict "pc" . "sc" $ ) }} {{ end }} diff --git a/layouts/blog/single.html b/layouts/blog/single.html index 571cca7..eb8530c 100644 --- a/layouts/blog/single.html +++ b/layouts/blog/single.html @@ -1,26 +1,37 @@ {{ define "title" }} - “{{ .Title | plainify }}” | {{ .Site.Title }} + “{{ .Title | plainify }}” | + {{ .Site.Title }} {{ end }} {{ define "main-class" }}--single layouts-blog-single{{ end }} {{ define "header-scripts" }} - {{ with .Params.locations }} - - {{ end }} + {{ with .Params.locations }} + + {{ end }} {{ end }} {{ define "header-styles" }} - {{ with .Params.styles }} - - {{ end }} - {{ with .Params.locations }} - - {{ end }} + {{ with .Params.styles }} + + {{ end }} + {{ with .Params.locations }} + + {{ end }} {{ end }} {{ define "footer-scripts" }} - {{ with .Params.locations }} + {{ with .Params.locations }} - {{ end }} - {{ if $.HasShortcode "chart" }} - {{ $chartsConfigJS := $.Page.Resources.GetMatch "charts-init" | fingerprint }} - - - {{ end }} + {{ end }} + {{ if $.HasShortcode "chart" }} + {{ $chartsConfigJS := $.Page.Resources.GetMatch "charts-init" | fingerprint }} + + + {{ end }} {{ end }} {{ define "main-header" }} -
- {{ if .Params.series }} -

Part of series: - {{ range ( .GetTerms "series" ) }} - {{ .LinkTitle }} - {{ end }} -

- {{ end }} - {{ with .Params.featured_image }} - - {{ end }} -
-
- -

- {{- .Title | safeHTML -}} -

- {{ with .Params.subtitle }} -

{{ . | safeHTML }}

- {{ end }} -
- {{ with .Resources.GetMatch .Params.featured_image }} -

- {{- if .Params.attrlink -}}{{- end -}} - {{- .Params.attr | safeHTML -}} - {{- if .Params.attrlink -}}{{- end -}} - {{- if .Params.attrlicence }} ( - {{- with .Params.attrlicencelink -}} - - {{- end -}} - {{- .Params.attrlicence -}} - {{- with .Params.attrlicencelink -}} - - {{- end -}} - ) - {{- end -}} -

- {{ end }} -

- -

~{{ .FuzzyWordCount | lang.FormatNumberCustom 0 }} words

- -

Published:

- -

Last modified:

- -

Author{{ with .Params.authors }}s{{ end }}:  - {{- with .Params.authors -}} -

- - {{- else -}} - - {{- end -}} -

- - {{ $post_age_in_years := math.Round ( div ( div ( now.Sub .PublishDate ).Hours 24 ) 365 ) }} - {{ if ( or .Params.site .Params.controversial ( gt $post_age_in_years 2 ) ) }} - - {{ end }} - - {{ if .Params.notes }} - - {{ end }} - - {{ if and ( .TableOfContents ) ( ne .TableOfContents "" ) }} - - {{ end }} -
+ {{ partial "single/main-header.html" ( dict "pc" . "sc" $ ) }} {{ end }} {{ define "main-body" }} -
- - {{ with .Summary }} -
-

Summary

-

{{ . }}

-
- {{ end }} - - {{- if ( or .Params.internal_links .Params.external_links ) -}} -
- {{- with .Params.internal_links -}} -

Internal Links

- +
+ {{ with .Summary }} +
+

Summary

+

{{ . }}

+
+ {{ end }} + + {{- if ( or .Params.internal_links .Params.external_links ) -}} +
+ {{- with .Params.internal_links -}} +

Internal Links

+
    + {{- range . -}} + {{ if eq ( printf "%T" . ) "map[string]interface {}" }} +
  • {{ .title | safeHTML }}
  • + {{ else }} +
  • Link
  • + {{ end }} + {{- end -}} +
+ {{- end -}} + + {{- with .Params.external_links -}} +

External Links

+
    + {{- range . -}} + {{ if eq ( printf "%T" . ) "map[string]interface {}" }} +
  • {{ .title | safeHTML }}
  • + {{ else }} +
  • Link
  • + {{ end }} + {{- end -}} +
+ {{- end -}} +
{{- end -}} - - {{- with .Params.external_links -}} -

External Links

-
    - {{- range . -}} - {{ if eq ( printf "%T" . ) "map[string]interface {}" }} -
  • {{ .title | safeHTML }}
  • - {{ else }} -
  • Link
  • - {{ end }} - {{- end -}} -
- {{- end -}} -
- {{- end -}} - -
+ + +
{{ .Content }}
- - {{ if fileExists ( path.Join $.Page.File.Dir "appendices.md" ) }} -
-

Appendices

- {{ $file := path.Join $.Page.File.Dir "appendices.md" | readFile }} - {{ $file | .RenderString }} -
- {{ end }} - {{ if fileExists ( path.Join $.Page.File.Dir "corrigendum.md" ) }} -
-

Corrigendum

- {{ $file := path.Join $.Page.File.Dir "corrigendum.md" | readFile }} - {{ $file | .RenderString }} -
- {{ end }} + {{ if fileExists ( path.Join $.Page.File.Dir "appendices.md" ) }} +
+

+ Appendices +

+ {{ $file := path.Join $.Page.File.Dir "appendices.md" | readFile }} + {{ $file | .RenderString }} +
+ {{ end }} + + {{ if fileExists ( path.Join $.Page.File.Dir "corrigendum.md" ) }} +
+

+ Corrigendum +

+ {{ $file := path.Join $.Page.File.Dir "corrigendum.md" | readFile }} + {{ $file | .RenderString }} +
+ {{ end }}
{{ with .Page.Resources.Get "comments.md" }}
-

Comments

+

+ Comments +

    - {{ .RenderShortcodes }} + {{ .RenderShortcodes }}
{{ end }} {{ end }} {{ define "main-footer" }} -{{ partial "post-meta.html" . }} + {{ partial "single/post-meta.html" ( dict "pc" . "sc" $ ) }} {{ end }} diff --git a/layouts/partials/cv/organisation/get-title.html b/layouts/partials/cv/organisation/get-title.html new file mode 100644 index 0000000..50d7e5f --- /dev/null +++ b/layouts/partials/cv/organisation/get-title.html @@ -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 -}} +
  • {{- partialCached "redact-black.html" . -}}
  • + {{- end -}} +{{- else -}} +
  • + {{ 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 }} +
  • +{{- end -}} diff --git a/layouts/partials/images/get-image.html b/layouts/partials/images/get-image.html new file mode 100644 index 0000000..efc0ca9 --- /dev/null +++ b/layouts/partials/images/get-image.html @@ -0,0 +1,25 @@ +{{- /* + Renders an image, resizing it if valid. + + @params img The image. + */ +-}} + + + + +{{- if ne .img.MediaType.MainType "image" -}} + {{- errorf "Image '%q' is not an image" .img }} +{{- end -}} + + + + +{{- $isResizable := in ( slice "avif" "svg" "gif" ) .MediaType.SubType -}} +{{- if $isResizable -}} + {{- with .Resize "1200x webp" -}} + {{- .RelPermalink -}} + {{- end -}} +{{- else }} + {{- .RelPermalink -}} +{{- end -}} diff --git a/layouts/partials/post-meta.html b/layouts/partials/post-meta.html deleted file mode 100644 index 3b6aab1..0000000 --- a/layouts/partials/post-meta.html +++ /dev/null @@ -1,91 +0,0 @@ -
    -

    Meta

    - - {{- if .GetTerms "categories" -}} - - {{- end -}} - - {{- if .GetTerms "areas" -}} - - {{- end -}} - - {{- if .GetTerms "skills" -}} - - {{- end -}} - - {{- if .GetTerms "organisations" -}} - - {{- end -}} - - {{- if .GetTerms "locations" -}} - - {{- end -}} - - {{- if .GetTerms "tags" -}} - - {{- end -}} -
    diff --git a/layouts/partials/single/main-header.html b/layouts/partials/single/main-header.html new file mode 100644 index 0000000..aba889a --- /dev/null +++ b/layouts/partials/single/main-header.html @@ -0,0 +1,43 @@ +{{- /* + Displays the header information for an item. + + @params pc Page context + @params sc 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 -}} + + + + +
    + {{ 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 ) }} +
    diff --git a/layouts/partials/single/main-header/authors.html b/layouts/partials/single/main-header/authors.html new file mode 100644 index 0000000..3c0d9b6 --- /dev/null +++ b/layouts/partials/single/main-header/authors.html @@ -0,0 +1,23 @@ +{{- /* + Renders the authors for an item. + + @params authors The item's author(s). + @params sc The site context. +*/ -}} + +

    Author{{ with .authors }}s{{ end }}:  +{{- with .authors -}} +

    + +{{- else -}} + +{{- end -}} +

    diff --git a/layouts/partials/single/main-header/dates.html b/layouts/partials/single/main-header/dates.html new file mode 100644 index 0000000..b03e81c --- /dev/null +++ b/layouts/partials/single/main-header/dates.html @@ -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 }} + + +

    + Published: + +

    + +

    + Last modified: + +

    diff --git a/layouts/partials/single/main-header/item-tile.html b/layouts/partials/single/main-header/item-tile.html new file mode 100644 index 0000000..529c870 --- /dev/null +++ b/layouts/partials/single/main-header/item-tile.html @@ -0,0 +1,70 @@ +{{- /* + Renders the header tile for an item. + + @params pc The page context. + @params sc The site context. +*/ -}} + +{{- if ( not ( isset . "sc" ) ) -}} + {{- errorf "No site context received" -}} +{{- end -}} + +{{- if ( not ( isset . "pc" ) ) -}} + {{- errorf "No page context received (%q)" .sc.Page.File.Dir -}} +{{- end -}} + +{{ with .pc.Params.featured_image }} + +{{ end }} + +
    + +
    + +
    +

    + {{- .pc.Title | safeHTML -}} +

    + {{ with .pc.Params.subtitle }} +

    {{ . | safeHTML }}

    + {{ end }} +
    +
    + + {{ with ( .pc.Resources.GetMatch .pc.Params.featured_image ) }} +

    + {{- with .Params.attrlink -}}{{- end -}} + {{- .Params.attr | safeHTML -}} + {{- if .Params.attrlink -}}{{- end -}} + {{- if .Params.attrlicence }} ( + {{- with .Params.attrlicencelink -}} + + {{- end -}} + {{- .Params.attrlicence -}} + {{- if .Params.attrlicencelink -}} + + {{- end -}} + ) + {{- end -}} +

    + {{ end }} +

    diff --git a/layouts/partials/single/main-header/notes.html b/layouts/partials/single/main-header/notes.html new file mode 100644 index 0000000..17d0771 --- /dev/null +++ b/layouts/partials/single/main-header/notes.html @@ -0,0 +1,16 @@ +{{- /* + Renders the notes for an item. + + @params note The notes for an item. + @params sc Site context. + */ +-}} + + + diff --git a/layouts/partials/single/main-header/series.html b/layouts/partials/single/main-header/series.html new file mode 100644 index 0000000..372ef6c --- /dev/null +++ b/layouts/partials/single/main-header/series.html @@ -0,0 +1,18 @@ +{{- /* + Renders the series of an item. + + @params series A list of series' for the item. + */ +-}} + + +

    + Part of series: + {{ range .series }} + {{ .LinkTitle }} + {{ end }} +

    diff --git a/layouts/partials/single/main-header/toc.html b/layouts/partials/single/main-header/toc.html new file mode 100644 index 0000000..1da4e9e --- /dev/null +++ b/layouts/partials/single/main-header/toc.html @@ -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 := "" }} + +{{ if and ( .toc ) ( ne .toc $empty_toc_html ) }} + +{{ end }} diff --git a/layouts/partials/single/main-header/warnings.html b/layouts/partials/single/main-header/warnings.html new file mode 100644 index 0000000..5a2d3a2 --- /dev/null +++ b/layouts/partials/single/main-header/warnings.html @@ -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 ) ) }} + +{{ end }} diff --git a/layouts/partials/single/main-header/word-count.html b/layouts/partials/single/main-header/word-count.html new file mode 100644 index 0000000..64283c5 --- /dev/null +++ b/layouts/partials/single/main-header/word-count.html @@ -0,0 +1,9 @@ +{{- /* + Displays the length of an item. + + @params wordCount The wordcount of an item. + */ +-}} + + +

    ~{{ .wordCount | lang.FormatNumberCustom 0 }} words

    diff --git a/layouts/partials/single/post-meta.html b/layouts/partials/single/post-meta.html new file mode 100644 index 0000000..1d874ca --- /dev/null +++ b/layouts/partials/single/post-meta.html @@ -0,0 +1,36 @@ +{{- /* + Displays the meta information for an item. + + @params pc Page context + @params sc Site context + */ +-}} + + +
    +

    Meta

    + + {{- 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 -}} +
    diff --git a/layouts/partials/single/post-meta/categories.html b/layouts/partials/single/post-meta/categories.html new file mode 100644 index 0000000..6060030 --- /dev/null +++ b/layouts/partials/single/post-meta/categories.html @@ -0,0 +1,21 @@ +{{- /* + Displays the categories for an item. + + @params categories The item's categories. + */ +-}} + + + diff --git a/layouts/partials/single/post-meta/life-areas.html b/layouts/partials/single/post-meta/life-areas.html new file mode 100644 index 0000000..ac7110e --- /dev/null +++ b/layouts/partials/single/post-meta/life-areas.html @@ -0,0 +1,19 @@ +{{- /* + Displays the life areas for an item. + + @params areas The item's life areas. + */ +-}} + + + diff --git a/layouts/partials/single/post-meta/locations.html b/layouts/partials/single/post-meta/locations.html new file mode 100644 index 0000000..6d3b84a --- /dev/null +++ b/layouts/partials/single/post-meta/locations.html @@ -0,0 +1,23 @@ +{{- /* + Displays the locations for an item. + + @params locations The locations or the item. + */ +-}} + + + diff --git a/layouts/partials/single/post-meta/organisations.html b/layouts/partials/single/post-meta/organisations.html new file mode 100644 index 0000000..f5b090a --- /dev/null +++ b/layouts/partials/single/post-meta/organisations.html @@ -0,0 +1,31 @@ +{{- /* + Displays the organisations for an item. + + @params pc The page context. + @params sc The site context. + */ +-}} + + + diff --git a/layouts/partials/single/post-meta/skills.html b/layouts/partials/single/post-meta/skills.html new file mode 100644 index 0000000..8010ed9 --- /dev/null +++ b/layouts/partials/single/post-meta/skills.html @@ -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. + */ +-}} + + + diff --git a/layouts/partials/single/post-meta/tags.html b/layouts/partials/single/post-meta/tags.html new file mode 100644 index 0000000..f9ca6da --- /dev/null +++ b/layouts/partials/single/post-meta/tags.html @@ -0,0 +1,19 @@ +{{- /* + Displays the tags for an item. + + @params tags The tags or the item. + */ +-}} + + + diff --git a/layouts/partials/text/foreign-text.html b/layouts/partials/text/foreign-text.html new file mode 100644 index 0000000..95d4ca3 --- /dev/null +++ b/layouts/partials/text/foreign-text.html @@ -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. + */ +-}} + + +{{ .original }}