From 3db54fdfd1a1384a4f37d4ab34e49b4da289c358 Mon Sep 17 00:00:00 2001 From: Hendrik Hogertz Date: Thu, 6 Nov 2025 00:36:18 +0100 Subject: [PATCH] Add eager loading and high fetchpriority for LCP image --- content/_index.md | 7 +++- layouts/shortcodes/figure.html | 61 ++++++++++++++++++++++++++++++++++ 2 files changed, 67 insertions(+), 1 deletion(-) create mode 100644 layouts/shortcodes/figure.html diff --git a/content/_index.md b/content/_index.md index 8e8ee5e..cee55b2 100644 --- a/content/_index.md +++ b/content/_index.md @@ -1,6 +1,11 @@ # Musikverein Molbergen -![Gruppenfoto des Musikverein Molbergen im Brgerpark Molbergen](ABP_4586.jpeg) +{{< figure + src="ABP_4586.jpeg" + alt="Gruppenfoto des Musikverein Molbergen im Bürgerpark Molbergen" + fetchpriority="high" + loading="eager" + >}} Der Musikverein Molbergen besteht aktuell aus rund 115 aktiven Mitgliedern, 71% davon weiblich. Das Durchschnittsalter der Mitglieder liegt bei 25 Jahren. Der Verein teilt sich in 10 Register auf, die von unserer Dirigentin Ingrid Sieve auf Kurs gehalten werden. Jeden Donnerstagabend finden von 18.30 Uhr – 19.30 Uhr die Proben des Jugendorchesters und von 20:00 Uhr – 22.00 Uhr die Proben des Hauptorchesters im Molberger Pfarrheim statt. diff --git a/layouts/shortcodes/figure.html b/layouts/shortcodes/figure.html new file mode 100644 index 0000000..3faf5cd --- /dev/null +++ b/layouts/shortcodes/figure.html @@ -0,0 +1,61 @@ +{{ $disableImageOptimization := .Site.Params.disableImageOptimization | default +false }} {{ if .Get "default" }} {{ partial +"hugo-embedded/shortcodes/figure-default.html" . }} {{ else }} {{- $url := +urls.Parse (.Get "src") }} {{- $altText := .Get "alt" }} {{- $caption := .Get +"caption" }} {{- $href := .Get "href" }} {{- $class := .Get "class" }} {{- +$target := .Get "target" | default "_blank" }} {{- $nozoom := .Get "nozoom" | +default false -}} {{- $loading := .Get "loading" | default "lazy" -}} {{- +$fetchpriority := .Get "fetchpriority" | default "auto" -}} + +
+ {{- with $href }}{{ end -}} {{- if findRE "^https?" $url.Scheme }} + {{ $altText }} + {{- else }} {{- $resource := "" }} {{- if $.Page.Resources.GetMatch + ($url.String) }} {{- $resource = $.Page.Resources.GetMatch ($url.String) }} + {{- else if resources.GetMatch ($url.String) }} {{- $resource = + resources.Get ($url.String) }} {{- end }} {{- with $resource }} {{- if or + $disableImageOptimization (eq .MediaType.SubType "svg")}} + {{ $altText }} + {{- else }} {{ $altText }} + {{- end }} {{- else }} + {{ $altText }} + {{- end }} {{- end }} {{ if $href }}{{ end }} {{ with $caption }} +
{{ . | markdownify }}
+ {{ end }} +
+{{- end -}}