improve renderings

This commit is contained in:
Ben Goldsworthy 2025-03-02 22:41:10 +01:00
parent 4cd64207fe
commit 0a24223fe8
No known key found for this signature in database
8 changed files with 175 additions and 113 deletions

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

@ -1,22 +1,18 @@
{{- 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 ( eq $.Site.Params.redact "black" ) -}}
{{- partialCached "redact-black.html" . -}}
{{- end -}}
{{- if ( eq $.Site.Params.redact "black" ) -}}
{{- partialCached "redact-black.html" . -}}
{{- end -}}
{{- else -}}
<a href="{{ .RelPermalink }}">
{{- with .Params.markup_title }}
{{- . | safeHTML -}}
{{- else -}}
{{- .Title | safeHTML -}}
{{- end -}}
</a>
{{- range .Sections -}}
<ul>
{{- partialCached "cv/organisations/recursive-children.html" . .Title -}}
</ul>
{{- end -}}
<a href="{{ .RelPermalink }}">
{{ default .Title .Params.markup_title | .Page.RenderString }}
</a>
{{- range .Sections -}}
<ul>
{{- partialCached "cv/organisations/recursive-children.html" . .Title -}}
</ul>
{{- end -}}
{{- end -}}
</li>
</li>
{{- end -}}

View file

@ -1,33 +1,55 @@
{{- if ( and ( .Params.redact ) ( ne $.Site.Params.redact "show" ) ) -}}
{{- 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">
<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>
<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>
</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 -}}"
{{ if .Params.featured_image }}
{{ with .Resources.GetMatch .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 }}
{{ else }}
style="background-image: url({{ .Params.featured_image }})"
<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" }}
style="background-image: url({{ .RelPermalink }})"
{{ else }}
{{ with .Resize "1000x webp" }}
style="background-image: url({{ .RelPermalink }})"
{{ end }}
{{ end }}
>
{{ if .Params.featured_image -}}
<img class="u-photo" style="display: none;" src="
{{ else }}
style="background-image: url({{ .Params.featured_image }})"
{{ end }}
{{ end }}
>
{{ if .Params.featured_image -}}
<img
class="u-photo"
style="display: none;"
src="
{{- with .Resources.GetMatch .Params.featured_image -}}
{{- if eq .MediaType.SubType "svg" -}}
{{ .RelPermalink }}
@ -39,30 +61,48 @@
{{- else -}}
{{ .Params.featured_image }}
{{ end }}
" alt="
"
alt="
{{- with .Resources.GetMatch .Params.featured_image -}}
{{- .Params.alt -}}
{{- end -}}
"
/>
{{- 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}}">
/>
{{- 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 }}"
>
{{- if .Params.series -}}
{{ .Params.series | safeHTML }}
{{- else if .Params.published_in -}}
{{ .Params.published_in | safeHTML }}
{{- 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>
{{ with .Params.subtitle }}
<p class="item-tile__subtitle">{{ . | safeHTML }}</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>
{{ end }}
<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">{{ . | $.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>
</article>
</a>

View file

@ -41,11 +41,11 @@
<div class="article-header__title-wrapper">
<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 -}}
<h2 class="article-header__title {{ if gt ( len ( .pc.Title | plainify ) ) 40 }}article-header__title--long{{ end }}">
{{- 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>