From a025961ad548a98d311fceca5c17d3d742e29a5f Mon Sep 17 00:00:00 2001 From: Christian Wolf Date: Fri, 20 Jan 2023 15:31:30 +0100 Subject: [PATCH] Fix display of persons --- content/person/joseph-ripp/index.md | 1 + themes/tsc_vfl/archetypes/person.md | 1 + .../layouts/partials/tsc/start-person.html | 2 +- .../tsc_vfl/layouts/shortcodes/tsc/vorstand.html | 15 +++++++++++---- 4 files changed, 14 insertions(+), 5 deletions(-) diff --git a/content/person/joseph-ripp/index.md b/content/person/joseph-ripp/index.md index 60517f1..a7ce9bc 100644 --- a/content/person/joseph-ripp/index.md +++ b/content/person/joseph-ripp/index.md @@ -2,5 +2,6 @@ title: "Joseph Ripp" draft: true image: "" +sex: male headless: true --- diff --git a/themes/tsc_vfl/archetypes/person.md b/themes/tsc_vfl/archetypes/person.md index e757331..68b4b61 100644 --- a/themes/tsc_vfl/archetypes/person.md +++ b/themes/tsc_vfl/archetypes/person.md @@ -2,5 +2,6 @@ title: "{{ replace .Name "-" " " | title }}" draft: true image: "" +sex: male headless: true --- diff --git a/themes/tsc_vfl/layouts/partials/tsc/start-person.html b/themes/tsc_vfl/layouts/partials/tsc/start-person.html index 7d3ff57..3472694 100644 --- a/themes/tsc_vfl/layouts/partials/tsc/start-person.html +++ b/themes/tsc_vfl/layouts/partials/tsc/start-person.html @@ -2,7 +2,7 @@
{{- $param := . -}} {{- with .image -}} - + {{- end -}}
diff --git a/themes/tsc_vfl/layouts/shortcodes/tsc/vorstand.html b/themes/tsc_vfl/layouts/shortcodes/tsc/vorstand.html index dd0f505..5ce67f6 100644 --- a/themes/tsc_vfl/layouts/shortcodes/tsc/vorstand.html +++ b/themes/tsc_vfl/layouts/shortcodes/tsc/vorstand.html @@ -1,16 +1,23 @@ {{ with .Site.GetPage "person" }} - {{/*{{ $person := . }}*/}} {{ with .GetPage ($.Get "name") }} {{ $imageName := .Params.Get "image" }} {{ $image := "" }} {{ with .Resources.GetMatch $imageName}} - {{ $image = . }} + {{ $image = .RelPermalink }} {{ else }} {{ warnf "Image for %s is not correclty found. Falling back to default." ($.Get "name") }} {{ with .Resources.ByType "image" }} - {{ $image = index . 0 }} + {{ $image = (index . 0).RelPermalink }} {{ else }} - {{/* $image */}} + {{ with .Params.Get "sex" }} + {{ if eq . "male" }} + {{ $image = relURL "img/persons/male.png" }} + {{ else }} + {{ errorf "Generic female icon not found." }} + {{ end }} + {{ else }} + {{ warnf "Cannot find sex of %s." ($.Get "name") }} + {{ end }} {{ end }} {{ end }} {{ $config :=