fix: template layouts resulting in missing singles

This commit is contained in:
Ben Goldsworthy 2025-07-09 23:55:07 +02:00
parent 628acae725
commit a2a1dd2a7c
No known key found for this signature in database
7 changed files with 44 additions and 26 deletions

View file

@ -1,7 +1,6 @@
--- ---
title: CV title: CV
layout: cv layout: cv-root
type: cv
--- ---
This section is for things you have done in your life, e.g. jobs, roles, This section is for things you have done in your life, e.g. jobs, roles,

View file

@ -1,6 +1,6 @@
--- ---
title: Portfolio title: Portfolio
type: portfolio layout: portfolio-root
--- ---
This section is for things you have produced, whatever their formats and media. This section is for things you have produced, whatever their formats and media.

View file

@ -21,17 +21,17 @@
<!-- Rendering --> <!-- Rendering -->
<section <section
class="article-body__corrigendum" class="article-body__corrigenda"
itemprop="correction" itemprop="correction"
itemscope itemscope
itemtype="https://schema.org/CorrectionComment" itemtype="https://schema.org/CorrectionComment"
> >
<h2 <h2
class="subheading subheading--corrigendum" class="subheading subheading--corrigenda"
id="corrigendum" id="corrigenda"
> >
Corrigendum Corrigenda
</h2> </h2>
{{ $file := path.Join $.sc.Page.File.Dir "corrigendum.md" | readFile }} {{ $file := path.Join $.sc.Page.File.Dir "corrigenda.md" | readFile }}
{{ $file | .pc.RenderString }} {{ $file | .pc.RenderString }}
</section> </section>

View file

@ -1,16 +1,12 @@
{{ define "main-class" }}--section layouts-cv-cv{{ end }} {{ define "main-class" }}--section layouts-cv-cv{{ end }}
{{ define "header-scripts" }} {{ define "header-scripts" }}
{{ if ( or ( eq .Type "cv" ) ( .IsDescendant ( .GetPage "/cv/organisations" ) ) ) }} <script id="Google-Charts-script" src="/js/google-charts/google-charts.js"></script>
<script id="Google-Charts-script" src="/js/google-charts/google-charts.js"></script>
{{ end }}
{{ end }} {{ end }}
{{ define "footer-scripts" }} {{ 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 }}
{{ $js := resources.Get "js/roles-chart.js" | resources.ExecuteAsTemplate "/js/render-roles-timeline.js" ( .GetPage "cv/roles" ) | resources.Fingerprint }} <script src="{{ $js.RelPermalink }}" integrity="{{ $js.Data.Integrity }}"></script>
<script src="{{ $js.RelPermalink }}" integrity="{{ $js.Data.Integrity }}"></script>
{{- end -}}
{{ end }} {{ end }}
{{ define "main-header" }} {{ define "main-header" }}

View file

@ -10,18 +10,11 @@
{{ end }} {{ end }}
</h2> </h2>
{{ .Content }} {{ .Content }}
{{ if ne .Type "portfolio" }}
<nav class="page-header__minor-links">
{{ partial "years-list.html" . }}
</nav>
{{ end }}
</header> </header>
{{ end }} {{ end }}
{{ define "main-body" }} {{ define "main-body" }}
{{ if eq .Type "portfolio" }} <article class="site-content__body site-content__body--list">
<article class="site-content__body site-content__body--list">
<ul class="site-content__sections-list"> <ul class="site-content__sections-list">
{{ range .Sections.ByWeight }} {{ range .Sections.ByWeight }}
{{ if eq .Weight 10 }}<hr>{{ end }} {{ if eq .Weight 10 }}<hr>{{ end }}
@ -29,7 +22,4 @@
{{ end }} {{ end }}
</ul> </ul>
</article> </article>
{{ else }}
{{ partial "items-grid.html" . }}
{{ end }}
{{ end }} {{ end }}

22
layouts/section.html Normal file
View file

@ -0,0 +1,22 @@
{{ define "main-class" }}--section layouts-default-section{{ end }}
{{ define "main-header" }}
<header class="site-content__header">
<h2 class="page-title">{{ .Title | safeHTML }}.
{{ range .AlternativeOutputFormats -}}
<a href="{{ .RelPermalink }}">
<img class="feed-icon" src="{{ $.Site.Params.feedIcon }}">
</a>
{{ end }}
</h2>
{{ .Content }}
<nav class="page-header__minor-links">
{{ partial "years-list.html" . }}
</nav>
</header>
{{ end }}
{{ define "main-body" }}
{{ partial "items-grid.html" . }}
{{ end }}

11
layouts/single.html Normal file
View file

@ -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 }}