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" }}
{{ .Page.Title | plainify }} | {{ .Site.Title }}
{{ .Page.Title | plainify }} |
{{ .Site.Title }}
{{ end }}
{{ define "main-class" }}--section layouts-blog-section{{ end }}
@ -12,30 +13,52 @@
{{ define "main-header" }}
<header class="site-content__header">
<h2 class="page-title">{{ .Title | safeHTML }}
<h2 class="page-title">
{{ .Title | safeHTML }}
{{ if eq .Type "blog" }}
{{ with .GetPage "blog/posts" }}
{{ range .AlternativeOutputFormats -}}
<a href="{{ .RelPermalink }}" aria-label="{{ $.Title }} RSS feed">
<img class="feed-icon" alt="RSS feed" src="{{ $.Site.Params.feedIcon }}">
<a
href="{{ .RelPermalink }}"
aria-label="{{ $.Title }} RSS feed"
>
<img
class="feed-icon"
alt="RSS feed"
src="{{ $.Site.Params.feedIcon }}"
/>
</a>
{{ end }}
{{ end }}
{{ else }}
{{ range .AlternativeOutputFormats -}}
<a href="{{ .RelPermalink }}" aria-label="{{ $.Title }} RSS feed">
<img class="feed-icon" alt="RSS feed" src="{{ $.Site.Params.feedIcon }}">
<a
href="{{ .RelPermalink }}"
aria-label="{{ $.Title }} RSS feed"
>
<img
class="feed-icon"
alt="RSS feed"
src="{{ $.Site.Params.feedIcon }}"
/>
</a>
{{ end }}
{{ end }}
</h2>
{{ .Content }}
<nav class="page-header__minor-links">
<ul class="minor-links__categories">
<li><a href="/series"><h3>Series</h3></a> <p>({{ len .Site.Taxonomies.series }})</p></li>
<li>
<a href="/series"><h3>Series</h3></a>
<p>({{ len .Site.Taxonomies.series }})</p>
</li>
{{ range .Site.Taxonomies.categories }}
<li><a href="{{ .Page.RelPermalink }}"><h3>{{ .Page.Title | safeHTML }}</h3></a> <p>({{ len . }})</p></li>
<li>
<a href="{{ .Page.RelPermalink }}"><h3>{{ .Page.Title | safeHTML }}</h3></a>
<p>({{ len . }})</p>
</li>
{{ end }}
</ul>
{{ if eq .Type "blog" }}

View file

@ -1,5 +1,6 @@
{{ define "title" }}
{{ .Page.Title | plainify }} | {{ .Site.Title }}
{{ .Page.Title | plainify }} |
{{ .Site.Title }}
{{ end }}
{{ define "main-class" }}--section layouts-cv-organisations-section{{ end }}
@ -7,14 +8,18 @@
{{ define "main-header" }}
{{ if .IsDescendant ( .GetPage "/cv/organisations" ) }}
<header class="site-content__header">
<div class="article-header__featured-image"
<div
class="article-header__featured-image"
{{ if .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 }}
>
<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>
</header>

View file

@ -118,14 +118,14 @@
{{ define "main-header" }}
{{ if .IsDescendant ( .GetPage "/cv/organisations" ) }}
<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 }}
{{ with .Resources.GetMatch .Params.featured_image }}
style="background-image: url({{ .RelPermalink }})"
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 }}">
<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>
{{- with .Params.nka -}}<p>Now known as: {{ . }}</p>{{- end -}}
@ -198,8 +198,8 @@
{{ partial "cv/organisations/recursive-parents.html" ( dict "c" . "g" $ ) }}
{{- $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 -}}
<ul><li class="hierarchy-item hierarchy-item--current">{{ .Title | safeHTML }}</li>
{{- 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">{{ default .Title .Params.markup_title | .Page.RenderString }}</li>
{{ range .Sections }}<ul>{{ partial "cv/organisations/recursive-children.html" . }}</ul>{{ end }}
</ul>
{{- range $parents -}}</li></ul>{{- end -}}

View file

@ -29,13 +29,11 @@
{{- end -}}
{{- else -}}
{{- if .Params.featured_image -}}
<img class="organisation-table__logo" loading="lazy" src="
{{- if .Resources.GetMatch .Params.featured_image -}}
{{- ( .Resources.GetMatch .Params.featured_image ).RelPermalink -}}
{{- with .Resources.GetMatch .Params.featured_image -}}
<img class="organisations-table__logo" loading="lazy" src="{{- .RelPermalink -}}" {{ with .Params.bg }}style="background-color: {{ . }}"{{ end }}>
{{- else -}}
{{- .Params.featured_image -}}
<img class="organisations-table__logo" loading="lazy" src="{{- .Params.featured_image -}}">
{{- end -}}
">
{{- end -}}
{{- end -}}
</td>
@ -48,7 +46,7 @@
{{- else -}}
<a href="{{ .RelPermalink }}">
{{- 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 -}}
</a>
{{- end -}}

View file

@ -6,11 +6,7 @@
{{- end -}}
{{- else -}}
<a href="{{ .RelPermalink }}">
{{- with .Params.markup_title }}
{{- . | safeHTML -}}
{{- else -}}
{{- .Title | safeHTML -}}
{{- end -}}
{{ default .Title .Params.markup_title | .Page.RenderString }}
</a>
{{- range .Sections -}}
<ul>

View file

@ -2,16 +2,35 @@
{{- if ( eq $.Site.Params.redact "black" ) -}}
<article class="item-tile item-tile--redacted {{- with .Params.site }}item-tile--{{ . }}{{ end -}}">
<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
class="p-name item-tile__title{{ if gt ( len ( .Title | plainify ) ) 40 }}item-tile__title--long{{ end }}"
itemprop="name"
>
{{- 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>
<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>
</article>
{{- end -}}
{{- else -}}
<a id="{{ .Title | urlize }}" class="h-entry u-url link--tile" href="{{ .RelPermalink }}" itemprop="blogPost" itemscope itemtype="https://schema.org/BlogPosting">
<article class="item-tile lazy {{- with .Params.site }} item-tile--{{ . }}{{ end -}}"
<a
id="{{ .Title | urlize }}"
class="h-entry u-url link--tile"
href="{{ .RelPermalink }}"
itemprop="blogPost"
itemscope
itemtype="https://schema.org/BlogPosting"
>
<article
class="item-tile lazy {{- with .Params.site }}item-tile--{{ . }}{{ end -}}"
{{ if .Params.featured_image }}
{{ with .Resources.GetMatch .Params.featured_image }}
{{ if eq .MediaType.SubType "svg" }}
@ -27,7 +46,10 @@
{{ end }}
>
{{ if .Params.featured_image -}}
<img class="u-photo" style="display: none;" src="
<img
class="u-photo"
style="display: none;"
src="
{{- with .Resources.GetMatch .Params.featured_image -}}
{{- if eq .MediaType.SubType "svg" -}}
{{ .RelPermalink }}
@ -39,7 +61,8 @@
{{- else -}}
{{ .Params.featured_image }}
{{ end }}
" alt="
"
alt="
{{- with .Resources.GetMatch .Params.featured_image -}}
{{- .Params.alt -}}
{{- end -}}
@ -48,7 +71,13 @@
{{- end }}
<header class="item-tile__header">
{{ 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 -}}
{{ .Params.series | safeHTML }}
{{- else if .Params.published_in -}}
@ -56,13 +85,24 @@
{{- end -}}
</span>
{{ end }}
<h2 class="p-name item-tile__title{{ if gt ( len ( .Title | plainify ) ) 40 }} item-tile__title--long{{ end }}" itemprop="name">
{{ .Title | safeHTML }}
<h2
class="p-name item-tile__title {{ if gt ( len ( .Title | plainify ) ) 40 }}item-tile__title--long{{ end }}"
itemprop="name"
>
{{ default .Title .Params.markup_title | $.Page.RenderString }}
</h2>
{{ with .Params.subtitle }}
<p class="item-tile__subtitle">{{ . | safeHTML }}</p>
<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>
<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>
</article>
</a>

View file

@ -42,10 +42,10 @@
<a class="u-url u-uid" style="display: none" href="{{ .pc.Permalink }}"></a>
<hgroup class="p-name" itemprop="name">
<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>
{{ with .pc.Params.subtitle }}
<p class="article-header__subtitle">{{ . | safeHTML }}</p>
<p class="article-header__subtitle">{{ . | $.pc.Page.RenderString }}</p>
{{ end }}
</hgroup>
</div>

View file

@ -24,7 +24,7 @@
{{ 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>
<li>{{ default .Title .Params.markup_title | .Page.RenderString }}</li>
{{ end }}
{{- end -}}
</ul>