From f8bee3a8692049dbf81d5f497444823dbcb8b82c Mon Sep 17 00:00:00 2001 From: paspo Date: Sat, 13 Jul 2024 18:12:16 +0000 Subject: [PATCH] fix taxonomies list (#91) fixes #84 Reviewed-on: https://git.libreschool.org/BgLUG/bglug.it/pulls/91 Co-authored-by: paspo Co-committed-by: paspo --- layouts/_default/taxonomyshortblock.html | 52 ++++++++++++++++++++++++ 1 file changed, 52 insertions(+) create mode 100644 layouts/_default/taxonomyshortblock.html diff --git a/layouts/_default/taxonomyshortblock.html b/layouts/_default/taxonomyshortblock.html new file mode 100644 index 0000000..d122f09 --- /dev/null +++ b/layouts/_default/taxonomyshortblock.html @@ -0,0 +1,52 @@ +
+
+ + {{ $rasters := slice "jpeg" "png" }} + {{ $newres := "360x250 smart" }} + + {{/* di default, niente immagine */}} + {{- $featimg := "#" -}} + + {{- if .Params.image -}} + {{/* se è stata definita un'immagine featured */}} + {{- $img := .Page.Resources.GetMatch .Params.image -}} + {{- if $img -}} + {{- if in $rasters $img.MediaType.SubType -}} + {{- $img = $img.Fill $newres -}} + {{ end }} + {{- $featimg = $img.RelPermalink -}} + {{- end -}} + {{- else if .Params.featured -}} + {{/* se è stata definita un'immagine featured */}} + {{- $img := .Page.Resources.GetMatch .Params.featured -}} + {{- if $img -}} + {{- if in $rasters $img.MediaType.SubType -}} + {{- $img = $img.Fill $newres -}} + {{ end }} + {{- $featimg = $img.RelPermalink -}} + {{- end -}} + {{- else -}} + {{/* altrimenti prendo la prima risorsa immagine disponibile */}} + {{- $img := (.Page.Resources.ByType "image").GetMatch "**" -}} + {{- if $img -}} + {{- if in $rasters $img.MediaType.SubType -}} + {{- $img = $img.Fill $newres -}} + {{ end }} + {{- $featimg = $img.RelPermalink -}} + {{- end -}} + {{- end -}} + + {{ .Params.image_alt }} +
+

{{ .Title }}

+

+ {{ with .Description }} + {{- . | truncate 400 }} + {{- else }} + {{- .Summary | truncate 400 }} + {{- end }} +

+ {{ partial "tags.html" . }} +
+
+