refactor templates layout

@see https://gohugo.io/templates/new-templatesystem-overview/
This commit is contained in:
Ben Goldsworthy 2025-06-06 15:36:06 +02:00
parent a83f339dc8
commit 230c46411b
No known key found for this signature in database
102 changed files with 2 additions and 2 deletions

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