From a2a1dd2a7c73d38f9ae3ad0eb7280ef0d2cf4f0e Mon Sep 17 00:00:00 2001 From: Ben Goldsworthy Date: Wed, 9 Jul 2025 23:55:07 +0200 Subject: [PATCH] fix: template layouts resulting in missing singles --- content/cv/_index.md | 3 +-- content/portfolio/_index.md | 2 +- .../{corrigendum.html => corrigenda.html} | 10 ++++----- layouts/cv/{cv.html => cv-root.html} | 10 +++------ .../{section.html => portfolio-root.html} | 12 +--------- layouts/section.html | 22 +++++++++++++++++++ layouts/single.html | 11 ++++++++++ 7 files changed, 44 insertions(+), 26 deletions(-) rename layouts/_partials/single/main-body/{corrigendum.html => corrigenda.html} (72%) rename layouts/cv/{cv.html => cv-root.html} (71%) rename layouts/portfolio/{section.html => portfolio-root.html} (70%) create mode 100644 layouts/section.html create mode 100644 layouts/single.html diff --git a/content/cv/_index.md b/content/cv/_index.md index ffc0584..e3e9e2d 100644 --- a/content/cv/_index.md +++ b/content/cv/_index.md @@ -1,7 +1,6 @@ --- title: CV -layout: cv -type: cv +layout: cv-root --- This section is for things you have done in your life, e.g. jobs, roles, diff --git a/content/portfolio/_index.md b/content/portfolio/_index.md index 2ae4c01..8cafec1 100644 --- a/content/portfolio/_index.md +++ b/content/portfolio/_index.md @@ -1,6 +1,6 @@ --- title: Portfolio -type: portfolio +layout: portfolio-root --- This section is for things you have produced, whatever their formats and media. diff --git a/layouts/_partials/single/main-body/corrigendum.html b/layouts/_partials/single/main-body/corrigenda.html similarity index 72% rename from layouts/_partials/single/main-body/corrigendum.html rename to layouts/_partials/single/main-body/corrigenda.html index c35377c..d3c38e2 100644 --- a/layouts/_partials/single/main-body/corrigendum.html +++ b/layouts/_partials/single/main-body/corrigenda.html @@ -21,17 +21,17 @@

- Corrigendum + Corrigenda

- {{ $file := path.Join $.sc.Page.File.Dir "corrigendum.md" | readFile }} + {{ $file := path.Join $.sc.Page.File.Dir "corrigenda.md" | readFile }} {{ $file | .pc.RenderString }}
diff --git a/layouts/cv/cv.html b/layouts/cv/cv-root.html similarity index 71% rename from layouts/cv/cv.html rename to layouts/cv/cv-root.html index d70485a..ba18557 100644 --- a/layouts/cv/cv.html +++ b/layouts/cv/cv-root.html @@ -1,16 +1,12 @@ {{ define "main-class" }}--section layouts-cv-cv{{ end }} {{ define "header-scripts" }} - {{ if ( or ( eq .Type "cv" ) ( .IsDescendant ( .GetPage "/cv/organisations" ) ) ) }} - - {{ end }} + {{ end }} {{ define "footer-scripts" }} - {{ if ( not ( .IsDescendant ( .GetPage "/cv/organisations" ) ) ) }} - {{ $js := resources.Get "js/roles-chart.js" | resources.ExecuteAsTemplate "/js/render-roles-timeline.js" ( .GetPage "cv/roles" ) | resources.Fingerprint }} - - {{- end -}} + {{ $js := resources.Get "js/roles-chart.js" | resources.ExecuteAsTemplate "/js/render-roles-timeline.js" ( .GetPage "cv/roles" ) | resources.Fingerprint }} + {{ end }} {{ define "main-header" }} diff --git a/layouts/portfolio/section.html b/layouts/portfolio/portfolio-root.html similarity index 70% rename from layouts/portfolio/section.html rename to layouts/portfolio/portfolio-root.html index ad2db56..a0bc3ff 100644 --- a/layouts/portfolio/section.html +++ b/layouts/portfolio/portfolio-root.html @@ -10,18 +10,11 @@ {{ end }} {{ .Content }} - - {{ if ne .Type "portfolio" }} - - {{ end }} {{ end }} {{ define "main-body" }} - {{ if eq .Type "portfolio" }} -
+
    {{ range .Sections.ByWeight }} {{ if eq .Weight 10 }}
    {{ end }} @@ -29,7 +22,4 @@ {{ end }}
- {{ else }} - {{ partial "items-grid.html" . }} - {{ end }} {{ end }} diff --git a/layouts/section.html b/layouts/section.html new file mode 100644 index 0000000..32b1f40 --- /dev/null +++ b/layouts/section.html @@ -0,0 +1,22 @@ +{{ define "main-class" }}--section layouts-default-section{{ end }} + +{{ define "main-header" }} +
+

{{ .Title | safeHTML }}. + {{ range .AlternativeOutputFormats -}} + + + + {{ end }} +

+ {{ .Content }} + + +
+{{ end }} + +{{ define "main-body" }} + {{ partial "items-grid.html" . }} +{{ end }} diff --git a/layouts/single.html b/layouts/single.html new file mode 100644 index 0000000..b13bd61 --- /dev/null +++ b/layouts/single.html @@ -0,0 +1,11 @@ +{{ define "main-class" }}--single layouts-default-single{{ end }} + +{{ define "main-body-additional" }} + {{ if fileExists ( path.Join $.Page.File.Dir "appendices.md" ) }} + {{- partial "single/main-body/appendices.html" ( dict "pc" . "sc" $ ) -}} + {{ end }} + + {{ if fileExists ( path.Join $.Page.File.Dir "corrigenda.md" ) }} + {{- partial "single/main-body/corrigenda.html" ( dict "pc" . "sc" $ ) -}} + {{ end }} +{{ end }}