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,21 @@
{{- /*
Displays the categories for an item.
@params categories The item's categories.
*/
-}}
<section
id="post-categories"
class="article-footer__categories"
aria-labelledby="post-categories-title"
itemprop="articleSection"
>
<h3 id="post-categories-title">Categories</h3>
<ul>
{{- range .categories -}}
<li class="p-category"><a href="{{ .RelPermalink }}">{{ .LinkTitle | safeHTML }}</a></li>
{{- end -}}
</ul>
</section>

View file

@ -0,0 +1,19 @@
{{- /*
Displays the life areas for an item.
@params areas The item's life areas.
*/
-}}
<section
class="article-footer__links"
itemprop="articleSection"
>
<h3 id="item-areas-title">Areas</h3>
<ul>
{{- range .areas.ByTitle -}}
<li class="p-category"><a href="{{ .RelPermalink }}">{{ .LinkTitle }}</a></li>
{{- end -}}
</ul>
</section>

View file

@ -0,0 +1,23 @@
{{- /*
Displays the locations for an item.
@params locations The locations or the item.
*/
-}}
<section
id="post-locations"
class="article-footer__locations"
>
<h3>Locations</h3>
<div
id="map"
style="width: 100%; height: 500px; margin: 0; display: block;"
></div>
<ul style="display: none">
{{- range .locations.ByTitle -}}
<li class="p-location"><a href="{{ .RelPermalink }}">{{ .LinkTitle | safeHTML }}</a></li>
{{- end -}}
</ul>
</section>

View file

@ -0,0 +1,31 @@
{{- /*
Displays the organisations for an item.
@params pc The page context.
@params sc The site context.
*/
-}}
<section
id="post-organisations"
class="article-footer__organisations"
itemprop="articleSection"
>
<h3>Organisations</h3>
<ul>
{{ $all_organisations := partialCached "get_all_organisations.html" .pc }}
<!-- TODO: Replace with hierarchy partial -->
{{- range ( .pc.GetTerms "organisations" ) -}}
{{ $matched_organisations := ( union ( union ( where $all_organisations "Title" ( .Title | plainify ) ) ( where $all_organisations "Params.abbreviation" ( .Title | plainify ) ) ) ( where $all_organisations "Params.fka" ( .Title | plainify ) ) ) }}
{{ with $matched_organisations }}
{{ range . }}
{{ partial "cv/organisation/get-title.html" ( dict "organisation" . "site_redact" $.sc.Site.Params.redact ) .File.Dir }}
{{ end }}
{{ else }}
{{ erroridf "missing-organisation" "Could not find organisation %q (%q)" .Title $.sc.File.Path }}
<li>{{ if ( .Params.markup_title ) }}{{ .Params.markup_title | safeHTML }}{{ else }}{{ .Title }}{{ end }}</li>
{{ end }}
{{- end -}}
</ul>
</section>

View file

@ -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.
*/
-}}
<section
class="article-footer__links"
itemprop="articleSection"
>
<h3 id="item-skills-title">Skills</h3>
<ul>
{{- .pc.Scratch.Set "i" 0 -}}
{{- range .skills.ByTitle -}}
{{- if hasPrefix .LinkTitle "CIISec/" -}}
<li class="p-category">
<a href="{{ .RelPermalink }}">{{ .LinkTitle }}</a>
<span class="level">(level {{ index $.skills_ciisec_levels ( $.pc.Scratch.Get "i" ) }})</span>
</li>
{{- $.pc.Scratch.Add "i" 1 -}}
{{- else -}}
<li class="p-category"><a href="{{ .RelPermalink }}">{{ .LinkTitle }}</a></li>
{{- end -}}
{{- end -}}
</ul>
</section>

View file

@ -0,0 +1,19 @@
{{- /*
Displays the tags for an item.
@params tags The tags or the item.
*/
-}}
<section
id="post-tags"
class="article-footer__tags"
>
<h3>Tags</h3>
<ul>
{{- range .tags.ByTitle -}}
<li class="p-category"><a href="{{ .RelPermalink }}">{{ .LinkTitle | safeHTML }}</a></li>
{{- end -}}
</ul>
</section>