SEOOptimierungenAlex07092025

This commit is contained in:
astosic 2025-09-08 01:15:11 +02:00
parent 6828c3f835
commit b7f8f2ac5e
34 changed files with 4426 additions and 253 deletions

26
layouts/partials/img.html Normal file
View file

@ -0,0 +1,26 @@
{{/* 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 -}}
<img src="{{ $src | relURL }}"
alt="{{ $alt | plainify }}"
loading="{{ $loading }}"
decoding="async"
{{ if gt $w 0 }}width="{{ $w }}"{{ end }}
{{ if gt $h 0 }}height="{{ $h }}"{{ end }}
class="{{ $class }}">