refactor: split single header and meta components into partials

This commit is contained in:
Ben Goldsworthy 2025-01-27 23:34:33 +01:00
parent d0577aec91
commit e6889cabba
No known key found for this signature in database
22 changed files with 742 additions and 406 deletions

View 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>