{{/* Re-usable image partial with alt + size fallback Usage: {{ partial "img.html" (dict "src" "/images/foo.webp" "alt" "Kurzbeschreibung" "class" "img-fluid" "loading" "lazy" "page" .) }} */}} {{- $src := .src -}} {{- $alt := .alt | default .page.Title -}} {{- $class := .class -}} {{- $loading := .loading | default "lazy" -}} {{- $w := 0 -}} {{- $h := 0 -}} {{- $static := printf "static/%s" (strings.TrimLeft "/" $src) -}} {{- if fileExists $static -}} {{- with (imageConfig $static) -}} {{- $w = .Width -}} {{- $h = .Height -}} {{- end -}} {{- end -}} {{ $alt | plainify }}