improve renderings

This commit is contained in:
Ben Goldsworthy 2025-03-02 22:41:10 +01:00
parent 4cd64207fe
commit 0a24223fe8
Signed by: Rumperuu
SSH key fingerprint: SHA256:v3uompaUiPqV2w1/AIRWBSQOxr2dntH9Xs/y8fDnUPU
8 changed files with 175 additions and 113 deletions

View file

@ -1,5 +1,6 @@
{{ define "title" }} {{ define "title" }}
{{ .Page.Title | plainify }} | {{ .Site.Title }} {{ .Page.Title | plainify }} |
{{ .Site.Title }}
{{ end }} {{ end }}
{{ define "main-class" }}--section layouts-blog-section{{ end }} {{ define "main-class" }}--section layouts-blog-section{{ end }}
@ -12,38 +13,60 @@
{{ define "main-header" }} {{ define "main-header" }}
<header class="site-content__header"> <header class="site-content__header">
<h2 class="page-title">{{ .Title | safeHTML }} <h2 class="page-title">
{{ if eq .Type "blog" }} {{ .Title | safeHTML }}
{{ with .GetPage "blog/posts" }} {{ if eq .Type "blog" }}
{{ with .GetPage "blog/posts" }}
{{ range .AlternativeOutputFormats -}} {{ range .AlternativeOutputFormats -}}
<a href="{{ .RelPermalink }}" aria-label="{{ $.Title }} RSS feed"> <a
<img class="feed-icon" alt="RSS feed" src="{{ $.Site.Params.feedIcon }}"> href="{{ .RelPermalink }}"
aria-label="{{ $.Title }} RSS feed"
>
<img
class="feed-icon"
alt="RSS feed"
src="{{ $.Site.Params.feedIcon }}"
/>
</a> </a>
{{ end }} {{ end }}
{{ end }} {{ end }}
{{ else }} {{ else }}
{{ range .AlternativeOutputFormats -}} {{ range .AlternativeOutputFormats -}}
<a href="{{ .RelPermalink }}" aria-label="{{ $.Title }} RSS feed"> <a
<img class="feed-icon" alt="RSS feed" src="{{ $.Site.Params.feedIcon }}"> href="{{ .RelPermalink }}"
</a> aria-label="{{ $.Title }} RSS feed"
>
<img
class="feed-icon"
alt="RSS feed"
src="{{ $.Site.Params.feedIcon }}"
/>
</a>
{{ end }}
{{ end }} {{ end }}
{{ end }}
</h2> </h2>
{{ .Content }} {{ .Content }}
<nav class="page-header__minor-links"> <nav class="page-header__minor-links">
<ul class="minor-links__categories"> <ul class="minor-links__categories">
<li><a href="/series"><h3>Series</h3></a> <p>({{ len .Site.Taxonomies.series }})</p></li> <li>
{{ range .Site.Taxonomies.categories }} <a href="/series"><h3>Series</h3></a>
<li><a href="{{ .Page.RelPermalink }}"><h3>{{ .Page.Title | safeHTML }}</h3></a> <p>({{ len . }})</p></li> <p>({{ len .Site.Taxonomies.series }})</p>
{{ end }} </li>
{{ range .Site.Taxonomies.categories }}
<li>
<a href="{{ .Page.RelPermalink }}"><h3>{{ .Page.Title | safeHTML }}</h3></a>
<p>({{ len . }})</p>
</li>
{{ end }}
</ul> </ul>
{{ if eq .Type "blog" }} {{ if eq .Type "blog" }}
{{ with .GetPage "blog/posts" }} {{ with .GetPage "blog/posts" }}
{{ partial "years-list.html" . }} {{ partial "years-list.html" . }}
{{ end }} {{ end }}
{{ else }} {{ else }}
{{ partial "years-list.html" . }} {{ partial "years-list.html" . }}
{{ end }} {{ end }}
</nav> </nav>
</header> </header>
@ -51,10 +74,10 @@
{{ define "main-body" }} {{ define "main-body" }}
{{ if eq .Type "blog" }} {{ if eq .Type "blog" }}
{{ with .GetPage "blog/posts" }} {{ with .GetPage "blog/posts" }}
{{ partial "items-grid.html" . }}
{{ end }}
{{ else }}
{{ partial "items-grid.html" . }} {{ partial "items-grid.html" . }}
{{ end }}
{{ else }}
{{ partial "items-grid.html" . }}
{{ end }} {{ end }}
{{ end }} {{ end }}

View file

@ -1,35 +1,40 @@
{{ define "title" }} {{ define "title" }}
{{ .Page.Title | plainify }} | {{ .Site.Title }} {{ .Page.Title | plainify }} |
{{ .Site.Title }}
{{ end }} {{ end }}
{{ define "main-class" }}--section layouts-cv-organisations-section{{ end }} {{ define "main-class" }}--section layouts-cv-organisations-section{{ end }}
{{ define "main-header" }} {{ define "main-header" }}
{{ if .IsDescendant ( .GetPage "/cv/organisations" ) }} {{ if .IsDescendant ( .GetPage "/cv/organisations" ) }}
<header class="site-content__header"> <header class="site-content__header">
<div class="article-header__featured-image" <div
{{ if .Params.featured_image }} class="article-header__featured-image"
{{ with .Resources.GetMatch .Params.featured_image }} {{ if .Params.featured_image }}
style="background-image: url({{ .RelPermalink }})" {{ with .Resources.GetMatch .Params.featured_image }}
{{ end }} style="background-image: url({{ .RelPermalink }}); {{ with .Params.bg }}background-color: {{ . }};{{ end }}"
{{ end }}> {{ end }}
<div class="article-header__title-wrapper{{ if .Params.title_in_logo }} article-header__title-wrapper--no-title{{ end }}"> {{ end }}
<h2 class="article-header__title">{{ if ( .Params.markup_title ) }}{{ .Params.markup_title | safeHTML }}{{ else }}{{ .Title }}{{ end }}</h2> >
</div> <div class="article-header__title-wrapper{{ if .Params.title_in_logo }}article-header__title-wrapper--no-title{{ end }}">
</div> <h2 class="article-header__title">
</header> {{ default .Title .Params.markup_title | .Page.RenderString }}
{{ else }} </h2>
<header class="site-content__header"> </div>
<h2 class="page-title">{{ .Title | safeHTML }}.</h2> </div>
{{- .Content -}} </header>
</header> {{ else }}
{{ end }} <header class="site-content__header">
<h2 class="page-title">{{ .Title | safeHTML }}.</h2>
{{- .Content -}}
</header>
{{ end }}
{{ end }} {{ end }}
{{ define "main-body" }} {{ define "main-body" }}
{{ with .GetPage "cv/organisations" }} {{ with .GetPage "cv/organisations" }}
{{ partial "cv/organisations/organisations-table.html" . }} {{ partial "cv/organisations/organisations-table.html" . }}
{{ end }} {{ end }}
{{ end }} {{ end }}
{{ define "main-footer" }} {{ define "main-footer" }}

View file

@ -118,14 +118,14 @@
{{ define "main-header" }} {{ define "main-header" }}
{{ if .IsDescendant ( .GetPage "/cv/organisations" ) }} {{ if .IsDescendant ( .GetPage "/cv/organisations" ) }}
<header class="site-content__header"> <header class="site-content__header">
<div class="article-header__featured-image" <div class="article-header__featured-image article-header__featured-image--fit"
{{ if .Params.featured_image }} {{ if .Params.featured_image }}
{{ with .Resources.GetMatch .Params.featured_image }} {{ with .Resources.GetMatch .Params.featured_image }}
style="background-image: url({{ .RelPermalink }})" style="background-image: url({{ .RelPermalink }}); {{ with .Params.bg }}background-color: {{ . }};{{ end }}"
{{ end }} {{ end }}
{{ end }}> {{ end }}>
<div class="article-header__title-wrapper{{ if .Params.title_in_logo }} article-header__title-wrapper--no-title{{ end }}"> <div class="article-header__title-wrapper{{ if .Params.title_in_logo }} article-header__title-wrapper--no-title{{ end }}">
<h2 class="article-header__title">{{ if ( .Params.markup_title ) }}{{ .Params.markup_title | safeHTML }}{{ else }}{{ .Title }}{{ end }}</h2> <h2 class="article-header__title">{{ default .Title .Params.markup_title | .Page.RenderString }}</h2>
</div> </div>
</div> </div>
{{- with .Params.nka -}}<p>Now known as: {{ . }}</p>{{- end -}} {{- with .Params.nka -}}<p>Now known as: {{ . }}</p>{{- end -}}
@ -198,8 +198,8 @@
{{ partial "cv/organisations/recursive-parents.html" ( dict "c" . "g" $ ) }} {{ partial "cv/organisations/recursive-parents.html" ( dict "c" . "g" $ ) }}
{{- $parents := partial "cv/organisations/reverse-slice.html" ( $.Scratch.Get "parents" ) -}} {{- $parents := partial "cv/organisations/reverse-slice.html" ( $.Scratch.Get "parents" ) -}}
{{- range $parents -}}<ul><li class="hierarchy-item hierarchy-item--parent"><a href="{{ .RelPermalink }}">{{ .Title | safeHTML }}</a>{{- end -}} {{- range $parents -}}<ul><li class="hierarchy-item hierarchy-item--parent"><a href="{{ .RelPermalink }}">{{ default .Title .Params.markup_title | .Page.RenderString }}</a>{{- end -}}
<ul><li class="hierarchy-item hierarchy-item--current">{{ .Title | safeHTML }}</li> <ul><li class="hierarchy-item hierarchy-item--current">{{ default .Title .Params.markup_title | .Page.RenderString }}</li>
{{ range .Sections }}<ul>{{ partial "cv/organisations/recursive-children.html" . }}</ul>{{ end }} {{ range .Sections }}<ul>{{ partial "cv/organisations/recursive-children.html" . }}</ul>{{ end }}
</ul> </ul>
{{- range $parents -}}</li></ul>{{- end -}} {{- range $parents -}}</li></ul>{{- end -}}

View file

@ -29,13 +29,11 @@
{{- end -}} {{- end -}}
{{- else -}} {{- else -}}
{{- if .Params.featured_image -}} {{- if .Params.featured_image -}}
<img class="organisation-table__logo" loading="lazy" src=" {{- with .Resources.GetMatch .Params.featured_image -}}
{{- if .Resources.GetMatch .Params.featured_image -}} <img class="organisations-table__logo" loading="lazy" src="{{- .RelPermalink -}}" {{ with .Params.bg }}style="background-color: {{ . }}"{{ end }}>
{{- ( .Resources.GetMatch .Params.featured_image ).RelPermalink -}}
{{- else -}} {{- else -}}
{{- .Params.featured_image -}} <img class="organisations-table__logo" loading="lazy" src="{{- .Params.featured_image -}}">
{{- end -}} {{- end -}}
">
{{- end -}} {{- end -}}
{{- end -}} {{- end -}}
</td> </td>
@ -48,7 +46,7 @@
{{- else -}} {{- else -}}
<a href="{{ .RelPermalink }}"> <a href="{{ .RelPermalink }}">
{{- if .Params.TitleLang -}}<i lang="{{ .Params.TitleLang }}" title="{{ .Params.TitleTrans }}"}>{{- end -}} {{- if .Params.TitleLang -}}<i lang="{{ .Params.TitleLang }}" title="{{ .Params.TitleTrans }}"}>{{- end -}}
{{- with .Params.markup_title -}}{{- . | safeHTML -}}{{- else -}}{{- $organisation_title | safeHTML -}}{{- end -}} {{- with .Params.markup_title -}}{{- . | $.Page.RenderString -}}{{- else -}}{{- $organisation_title | $.Page.RenderString -}}{{- end -}}
{{- if .Params.TitleLang -}}</i>{{- end -}} {{- if .Params.TitleLang -}}</i>{{- end -}}
</a> </a>
{{- end -}} {{- end -}}

View file

@ -1,22 +1,18 @@
{{- if ( not ( and ( .Params.redact ) ( ne $.Site.Params.redact "show" ) ) ) -}} {{- if ( not ( and ( .Params.redact ) ( ne $.Site.Params.redact "show" ) ) ) -}}
<li class="hierarchy-item hierarchy-item--child"> <li class="hierarchy-item hierarchy-item--child">
{{- if ( and ( .Params.redact ) ( ne $.Site.Params.redact "show" ) ) -}} {{- if ( and ( .Params.redact ) ( ne $.Site.Params.redact "show" ) ) -}}
{{- if ( eq $.Site.Params.redact "black" ) -}} {{- if ( eq $.Site.Params.redact "black" ) -}}
{{- partialCached "redact-black.html" . -}} {{- partialCached "redact-black.html" . -}}
{{- end -}} {{- end -}}
{{- else -}} {{- else -}}
<a href="{{ .RelPermalink }}"> <a href="{{ .RelPermalink }}">
{{- with .Params.markup_title }} {{ default .Title .Params.markup_title | .Page.RenderString }}
{{- . | safeHTML -}} </a>
{{- else -}} {{- range .Sections -}}
{{- .Title | safeHTML -}} <ul>
{{- end -}} {{- partialCached "cv/organisations/recursive-children.html" . .Title -}}
</a> </ul>
{{- range .Sections -}} {{- end -}}
<ul>
{{- partialCached "cv/organisations/recursive-children.html" . .Title -}}
</ul>
{{- end -}}
{{- end -}} {{- end -}}
</li> </li>
{{- end -}} {{- end -}}

View file

@ -1,33 +1,55 @@
{{- if ( and ( .Params.redact ) ( ne $.Site.Params.redact "show" ) ) -}} {{- if ( and ( .Params.redact ) ( ne $.Site.Params.redact "show" ) ) -}}
{{- if ( eq $.Site.Params.redact "black" ) -}} {{- if ( eq $.Site.Params.redact "black" ) -}}
<article class="item-tile item-tile--redacted {{- with .Params.site }} item-tile--{{ . }}{{ end -}}"> <article class="item-tile item-tile--redacted {{- with .Params.site }}item-tile--{{ . }}{{ end -}}">
<header class="item-tile__header"> <header class="item-tile__header">
<h2 class="p-name item-tile__title{{ if gt ( len ( .Title | plainify ) ) 40 }} item-tile__title--long{{ end }}" itemprop="name"> <h2
{{- partialCached "redact-black.html" . -}} class="p-name item-tile__title{{ if gt ( len ( .Title | plainify ) ) 40 }}item-tile__title--long{{ end }}"
</h2> itemprop="name"
<p style="display: none;">Published: <time class="dt-published" itemprop="datePublished" datetime="{{ .PublishDate | time.Format "2006-01-02T15:04:05-07:00" }}">{{ .PublishDate | time.Format "2006-01-02T15:04:05-07:00"}}</time></p> >
{{- partialCached "redact-black.html" . -}}
</h2>
<p style="display: none;">
Published:
<time
class="dt-published"
itemprop="datePublished"
datetime="{{ .PublishDate | time.Format "2006-01-02T15:04:05-07:00" }}"
>{{ .PublishDate | time.Format "2006-01-02T15:04:05-07:00" }}</time
>
</p>
</header> </header>
</article> </article>
{{- end -}} {{- end -}}
{{- else -}} {{- else -}}
<a id="{{ .Title | urlize }}" class="h-entry u-url link--tile" href="{{ .RelPermalink }}" itemprop="blogPost" itemscope itemtype="https://schema.org/BlogPosting"> <a
<article class="item-tile lazy {{- with .Params.site }} item-tile--{{ . }}{{ end -}}" id="{{ .Title | urlize }}"
{{ if .Params.featured_image }} class="h-entry u-url link--tile"
{{ with .Resources.GetMatch .Params.featured_image }} href="{{ .RelPermalink }}"
{{ if eq .MediaType.SubType "svg" }} itemprop="blogPost"
style="background-image: url({{ .RelPermalink }})" itemscope
{{ else }} itemtype="https://schema.org/BlogPosting"
{{ with .Resize "1000x webp" }} >
style="background-image: url({{ .RelPermalink }})" <article
{{ end }} class="item-tile lazy {{- with .Params.site }}item-tile--{{ . }}{{ end -}}"
{{ end }} {{ if .Params.featured_image }}
{{ else }} {{ with .Resources.GetMatch .Params.featured_image }}
style="background-image: url({{ .Params.featured_image }})" {{ if eq .MediaType.SubType "svg" }}
style="background-image: url({{ .RelPermalink }})"
{{ else }}
{{ with .Resize "1000x webp" }}
style="background-image: url({{ .RelPermalink }})"
{{ end }} {{ end }}
{{ end }} {{ end }}
> {{ else }}
{{ if .Params.featured_image -}} style="background-image: url({{ .Params.featured_image }})"
<img class="u-photo" style="display: none;" src=" {{ end }}
{{ end }}
>
{{ if .Params.featured_image -}}
<img
class="u-photo"
style="display: none;"
src="
{{- with .Resources.GetMatch .Params.featured_image -}} {{- with .Resources.GetMatch .Params.featured_image -}}
{{- if eq .MediaType.SubType "svg" -}} {{- if eq .MediaType.SubType "svg" -}}
{{ .RelPermalink }} {{ .RelPermalink }}
@ -39,30 +61,48 @@
{{- else -}} {{- else -}}
{{ .Params.featured_image }} {{ .Params.featured_image }}
{{ end }} {{ end }}
" alt=" "
alt="
{{- with .Resources.GetMatch .Params.featured_image -}} {{- with .Resources.GetMatch .Params.featured_image -}}
{{- .Params.alt -}} {{- .Params.alt -}}
{{- end -}} {{- end -}}
" "
/> />
{{- end }} {{- end }}
<header class="item-tile__header"> <header class="item-tile__header">
{{ if ( or .Params.series .Params.published_in ) }} {{ if ( or .Params.series .Params.published_in ) }}
<span class="item-tile__banner item-tile__banner--{{ if .Params.series }}series{{ else if .Params.published_in }}published-in{{ end}}"> <span
class="item-tile__banner item-tile__banner--{{ if .Params.series }}
series
{{ else if .Params.published_in }}
published-in
{{ end }}"
>
{{- if .Params.series -}} {{- if .Params.series -}}
{{ .Params.series | safeHTML }} {{ .Params.series | safeHTML }}
{{- else if .Params.published_in -}} {{- else if .Params.published_in -}}
{{ .Params.published_in | safeHTML }} {{ .Params.published_in | safeHTML }}
{{- end -}} {{- end -}}
</span> </span>
{{ end }} {{ end }}
<h2 class="p-name item-tile__title{{ if gt ( len ( .Title | plainify ) ) 40 }} item-tile__title--long{{ end }}" itemprop="name"> <h2
{{ .Title | safeHTML }} class="p-name item-tile__title {{ if gt ( len ( .Title | plainify ) ) 40 }}item-tile__title--long{{ end }}"
</h2> itemprop="name"
{{ with .Params.subtitle }} >
<p class="item-tile__subtitle">{{ . | safeHTML }}</p> {{ default .Title .Params.markup_title | $.Page.RenderString }}
{{ end }} </h2>
<p style="display: none;">Published: <time class="dt-published" itemprop="datePublished" datetime="{{ .PublishDate | time.Format "2006-01-02T15:04:05-07:00" }}">{{ .PublishDate | time.Format "2006-01-02T15:04:05-07:00"}}</time></p> {{ with .Params.subtitle }}
<p class="item-tile__subtitle">{{ . | $.Page.RenderString }}</p>
{{ end }}
<p style="display: none;">
Published:
<time
class="dt-published"
itemprop="datePublished"
datetime="{{ .PublishDate | time.Format "2006-01-02T15:04:05-07:00" }}"
>{{ .PublishDate | time.Format "2006-01-02T15:04:05-07:00" }}</time
>
</p>
</header> </header>
</article> </article>
</a> </a>

View file

@ -41,11 +41,11 @@
<div class="article-header__title-wrapper"> <div class="article-header__title-wrapper">
<a class="u-url u-uid" style="display: none" href="{{ .pc.Permalink }}"></a> <a class="u-url u-uid" style="display: none" href="{{ .pc.Permalink }}"></a>
<hgroup class="p-name" itemprop="name"> <hgroup class="p-name" itemprop="name">
<h2 class="article-header__title{{ if gt ( len ( .pc.Title | plainify ) ) 40 }} article-header__title--long{{ end }}"> <h2 class="article-header__title {{ if gt ( len ( .pc.Title | plainify ) ) 40 }}article-header__title--long{{ end }}">
{{- .pc.Title | safeHTML -}} {{- default .pc.Title .pc.Params.markup_title | .pc.Page.RenderString -}}
</h2> </h2>
{{ with .pc.Params.subtitle }} {{ with .pc.Params.subtitle }}
<p class="article-header__subtitle">{{ . | safeHTML }}</p> <p class="article-header__subtitle">{{ . | $.pc.Page.RenderString }}</p>
{{ end }} {{ end }}
</hgroup> </hgroup>
</div> </div>

View file

@ -24,7 +24,7 @@
{{ end }} {{ end }}
{{ else }} {{ else }}
{{ erroridf "missing-organisation" "Could not find organisation %q (%q)" .Title $.sc.File.Path }} {{ 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> <li>{{ default .Title .Params.markup_title | .Page.RenderString }}</li>
{{ end }} {{ end }}
{{- end -}} {{- end -}}
</ul> </ul>