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

View file

@ -1,16 +1,36 @@
<!-- DNS preconnect -->
{{- /* Robust CSS loader: externe Links direkt, lokale Ressourcen sammeln, SCSS bauen, dann bündeln */ -}}
<!-- DNS prefetch on -->
<meta http-equiv="x-dns-prefetch-control" content="on">
{{- $bundleList := slice -}}
<!-- plugins + stylesheet -->
{{ $styles := slice }}
{{ range site.Params.plugins.css }}
{{ if findRE "^http" .link }}
<link crossorigin="anonymous" media="all" rel="stylesheet" href="{{ .link | relURL }}" {{.attributes | safeHTMLAttr}} >
{{ else }}
{{ $styles = $styles | append (resources.Get .link) }}
{{ end }}
{{ end }}
{{ $styles := $styles | append (resources.Get "scss/style.scss" | resources.ExecuteAsTemplate "style.scss" . | toCSS) }}
{{ $styles := $styles | resources.Concat "/css/style.css" | minify | fingerprint "sha512"}}
<link rel="stylesheet" href="{{ $styles.Permalink }}">
{{- /* 1) Plugins aus params: externe -> <link>, lokale -> sammeln */ -}}
{{- $plugins := site.Params.plugins.css | default (slice) -}}
{{- range $plugins }}
{{- $link := .link | default "" -}}
{{- if $link -}}
{{- if findRE `^https?://` $link -}}
<link rel="stylesheet" href="{{ $link }}" {{ .attributes | safeHTMLAttr }}>
{{- else -}}
{{- with (resources.Get $link) -}}
{{- $bundleList = $bundleList | append . -}}
{{- end -}}
{{- end -}}
{{- end -}}
{{- end -}}
{{- /* 2) SCSS bauen (falls vorhanden) und hinzufügen */ -}}
{{- with (resources.Get "scss/style.scss") -}}
{{- $css := . | resources.ExecuteAsTemplate "scss/style.scss" $ | toCSS (dict "targetPath" "css/style.css") -}}
{{- $bundleList = $bundleList | append $css -}}
{{- end -}}
{{- /* 3) Bündeln + minify + fingerprint, sofern wir was haben */ -}}
{{- if gt (len $bundleList) 0 -}}
{{- $bundle := $bundleList | resources.Concat "css/bundle.css" | minify | fingerprint "sha512" -}}
<link rel="stylesheet" href="{{ $bundle.RelPermalink }}" integrity="{{ $bundle.Data.Integrity }}">
{{- else -}}
{{- /* Fallback: statische CSS falls vorhanden/gewünscht */ -}}
<link rel="stylesheet" href="{{ "css/style.css" | relURL }}">
{{- end -}}