forked from markus/AMPERION_Webpage
SEOOptimierungenAlex07092025
This commit is contained in:
parent
6828c3f835
commit
b7f8f2ac5e
34 changed files with 4426 additions and 253 deletions
86
layouts/partials/breadcrumbs.html
Normal file
86
layouts/partials/breadcrumbs.html
Normal file
|
|
@ -0,0 +1,86 @@
|
|||
{{/* Breadcrumbs mit Microdata + JSON-LD
|
||||
- Zeigt nichts auf der Startseite
|
||||
- Crumbs: Startseite → (Sektion/Kategorie) → Aktuelle Seite
|
||||
- Sektionen werden auf DACH-taugliche Labels gemappt
|
||||
*/}}
|
||||
|
||||
{{ if not .IsHome }}
|
||||
|
||||
{{/* ------- Hilfsfunktionen/Labels ------- */}}
|
||||
{{ $section := .Section | default "" }}
|
||||
{{ $sectionLabel := "" }}
|
||||
{{ if eq $section "leistungen" }}{{ $sectionLabel = "Leistungen" }}
|
||||
{{ else if or (eq $section "post") (eq $section "posts") (eq $section "blog") (eq $section "blogs") (eq $section "news") }}{{ $sectionLabel = "Wissen" }}
|
||||
{{ else if or (eq $section "fokusthemen") (eq $section "themen") }}{{ $sectionLabel = "Fokusthemen" }}
|
||||
{{ else if eq $section "referenzen" }}{{ $sectionLabel = "Referenzen" }}
|
||||
{{ else if .CurrentSection }}{{ $sectionLabel = .CurrentSection.Title }}
|
||||
{{ end }}
|
||||
|
||||
{{ $crumbs := slice (dict "name" "Startseite" "url" ("/" | relURL)) }}
|
||||
|
||||
{{/* Sektion (falls vorhanden) */}}
|
||||
{{ if $sectionLabel }}
|
||||
{{ $secURL := cond .CurrentSection ( .CurrentSection.RelPermalink ) (printf "/%s/" $section | relURL) }}
|
||||
{{ $crumbs = $crumbs | append (dict "name" $sectionLabel "url" $secURL ) }}
|
||||
{{ end }}
|
||||
|
||||
{{/* Optional: erste Kategorie als weiterer Crumb (außer sie wäre ident mit Sektion) */}}
|
||||
{{ $cat := index .Params.categories 0 }}
|
||||
{{ if and $cat (ne (lower $cat) (lower $sectionLabel)) }}
|
||||
{{ $catPage := site.GetPage (printf "/categories/%s" (urlize $cat)) }}
|
||||
{{ $catURL := cond $catPage $catPage.RelPermalink (printf "/categories/%s/" (urlize $cat) | relURL) }}
|
||||
{{ $crumbs = $crumbs | append (dict "name" $cat "url" $catURL ) }}
|
||||
{{ end }}
|
||||
|
||||
{{/* Aktuelle Seite */}}
|
||||
{{ $crumbs = $crumbs | append (dict "name" .Title "url" .RelPermalink) }}
|
||||
|
||||
<nav class="breadcrumbs container" aria-label="Brotkrumen" itemscope itemtype="https://schema.org/BreadcrumbList">
|
||||
<ol>
|
||||
{{ range $i, $c := $crumbs }}
|
||||
{{ $pos := add $i 1 }}
|
||||
<li itemprop="itemListElement" itemscope itemtype="https://schema.org/ListItem">
|
||||
{{ if lt $i (sub (len $crumbs) 1) }}
|
||||
<a itemprop="item" href="{{ $c.url }}">
|
||||
<span itemprop="name">{{ $c.name }}</span>
|
||||
</a>
|
||||
{{ else }}
|
||||
<span itemprop="name" aria-current="page">{{ $c.name }}</span>
|
||||
{{ end }}
|
||||
<meta itemprop="position" content="{{ $pos }}" />
|
||||
</li>
|
||||
{{ end }}
|
||||
</ol>
|
||||
</nav>
|
||||
|
||||
<script type="application/ld+json">
|
||||
{
|
||||
"@context": "https://schema.org",
|
||||
"@type": "BreadcrumbList",
|
||||
"itemListElement": [
|
||||
{{- range $i, $c := $crumbs -}}
|
||||
{{- if $i }},{{ end -}}
|
||||
{
|
||||
"@type": "ListItem",
|
||||
"position": {{ add $i 1 }},
|
||||
"name": {{ $c.name | jsonify }},
|
||||
"item": {{ (absURL $c.url) | jsonify }}
|
||||
}
|
||||
{{- end -}}
|
||||
]
|
||||
}
|
||||
</script>
|
||||
|
||||
<style>
|
||||
/* Minimal-Styles; kollidiert nicht mit deinem Theme */
|
||||
.breadcrumbs { font-size:.875rem; margin: 8px auto 0; }
|
||||
.breadcrumbs ol { list-style:none; padding:0; margin:0; display:flex; flex-wrap:wrap; gap:.35rem; align-items:center }
|
||||
.breadcrumbs li { color:#6b7280 } /* neutral-500 */
|
||||
.breadcrumbs a { color:inherit; text-decoration:none }
|
||||
.breadcrumbs a:hover { text-decoration:underline }
|
||||
.breadcrumbs li::after { content:"/"; margin:0 .35rem; opacity:.5 }
|
||||
.breadcrumbs li:last-child::after { content:"" }
|
||||
@media (max-width: 768px) { .breadcrumbs { padding:0 16px } }
|
||||
</style>
|
||||
|
||||
{{ end }}
|
||||
|
|
@ -1,87 +1,122 @@
|
|||
{{ partial "seo.html" . }}
|
||||
|
||||
<meta charset="utf-8">
|
||||
<title>{{.Title | default site.Title}}</title>
|
||||
|
||||
<!-- base url -->
|
||||
<title>
|
||||
{{- if .IsHome -}}
|
||||
Ingenieurbüro für PV, Speicher & Ladeinfrastruktur | AMPERION
|
||||
{{- else -}}
|
||||
{{- with .Params.meta_title -}}
|
||||
{{ . }}
|
||||
{{- else -}}
|
||||
{{ .Title }} | AMPERION
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
</title>
|
||||
|
||||
<!-- base url (vom Theme genutzt, belassen) -->
|
||||
{{ if or (eq site.BaseURL "/") (eq site.BaseURL "http://localhost:1313/") (eq site.BaseURL "http://examplesite.org/") (eq site.BaseURL "https://examplesite.org/") (eq site.BaseURL "http://examplesite.com/") (eq site.BaseURL "https://examplesite.com/")}}{{else}}
|
||||
<base href="{{ .Permalink }}">
|
||||
{{ end }}
|
||||
|
||||
<!-- multilingual SEO optimizations -->
|
||||
{{ if .IsTranslated }}
|
||||
{{ range .AllTranslations }}
|
||||
<link rel="alternate" hreflang="{{.Lang}}" href="{{ .RelPermalink | absLangURL }}">
|
||||
{{ end }}
|
||||
<link rel="alternate" hreflang="x-default" href="{{ .RelPermalink | absLangURL }}">
|
||||
<!-- Canonical + self-referential hreflang -->
|
||||
<link rel="canonical" href="{{ .Permalink }}">
|
||||
<link rel="alternate" hreflang="{{ site.LanguageCode | default `de-AT` }}" href="{{ .Permalink }}">
|
||||
{{ if not .IsTranslated }}
|
||||
<link rel="alternate" hreflang="x-default" href="{{ .Permalink }}">
|
||||
{{ end }}
|
||||
|
||||
<!-- mobile responsive meta -->
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=5">
|
||||
<meta name="description" content="{{ .Params.Description | default site.Params.description }}">
|
||||
{{ with site.Params.author }}
|
||||
<meta name="author" content="{{ . }}">{{ end }}
|
||||
<!-- Multilingual alternates -->
|
||||
{{ if .IsTranslated }}
|
||||
{{ range .AllTranslations }}
|
||||
<link rel="alternate" hreflang="{{ .Lang }}" href="{{ .RelPermalink | absLangURL }}">
|
||||
{{ end }}
|
||||
<link rel="alternate" hreflang="x-default" href="{{ .RelPermalink | absLangURL }}">
|
||||
{{ end }}
|
||||
|
||||
<!-- Viewport: nur EIN Tag -->
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
|
||||
{{ with site.Params.author }}<meta name="author" content="{{ . }}">{{ end }}
|
||||
{{ hugo.Generator }}
|
||||
|
||||
<!-- theme meta -->
|
||||
<!-- Optional: manuelles Preload von Bildern pro Seite -->
|
||||
{{ with .Params.preload_images }}
|
||||
{{ range . }}
|
||||
<link rel="preload" as="image" href="{{ . | relURL }}">
|
||||
{{ end }}
|
||||
{{ end }}
|
||||
|
||||
{{ with .Params.robots }}<meta name="robots" content="{{ . }}">{{ end }}
|
||||
|
||||
<!-- Theme / Manifest / Favicons -->
|
||||
<meta name="theme-name" content="airspace-hugo" />
|
||||
|
||||
<!-- favicon -->
|
||||
{{ $favicon:= site.Params.favicon }}
|
||||
{{ $favicon := site.Params.favicon }}
|
||||
{{ if $favicon }}
|
||||
{{ if fileExists (add `assets/` $favicon) }}
|
||||
{{ $favicon:= resources.Get $favicon }}
|
||||
{{ $favicon_16:= $favicon.Resize "16x png"}}
|
||||
{{ $favicon_32:= $favicon.Resize "32x png"}}
|
||||
{{ $favicon_180:= $favicon.Resize "180x png"}}
|
||||
<link rel="shortcut icon" href="{{$favicon_32.RelPermalink}}" type="image/x-icon">
|
||||
<link rel="icon" href="{{$favicon_32.RelPermalink}}" type="image/x-icon">
|
||||
<link rel="icon" type="image/png" sizes="16x16" href="{{$favicon_16.RelPermalink}}">
|
||||
<link rel="icon" type="image/png" sizes="32x32" href="{{$favicon_32.RelPermalink}}">
|
||||
<link rel="apple-touch-icon" sizes="180x180" href="{{$favicon_180.RelPermalink}}">
|
||||
{{ if fileExists (add `assets/` $favicon) }}
|
||||
{{ $fav := resources.Get $favicon }}
|
||||
{{ $f16 := $fav.Resize "16x png" }}
|
||||
{{ $f32 := $fav.Resize "32x png" }}
|
||||
{{ $f180 := $fav.Resize "180x png" }}
|
||||
<link rel="shortcut icon" href="{{ $f32.RelPermalink }}" type="image/x-icon">
|
||||
<link rel="icon" href="{{ $f32.RelPermalink }}" type="image/x-icon">
|
||||
<link rel="icon" type="image/png" sizes="16x16" href="{{ $f16.RelPermalink }}">
|
||||
<link rel="icon" type="image/png" sizes="32x32" href="{{ $f32.RelPermalink }}">
|
||||
<link rel="apple-touch-icon" sizes="180x180" href="{{ $f180.RelPermalink }}">
|
||||
{{ end }}
|
||||
{{ end }}
|
||||
{{ end }}
|
||||
<link rel="manifest" href="{{`manifest.webmanifest` | relLangURL }}">
|
||||
<meta name="msapplication-TileColor" content="{{site.Params.variables.color_primary | default `#da532c`}}">
|
||||
<meta name="theme-color" content="{{site.Params.variables.body_color | default `#ffffff` }}">
|
||||
<link rel="manifest" href="{{ `manifest.webmanifest` | relLangURL }}">
|
||||
<meta name="msapplication-TileColor" content="{{ site.Params.variables.color_primary | default `#da532c` }}">
|
||||
<meta name="theme-color" content="{{ site.Params.variables.body_color | default `#ffffff` }}">
|
||||
|
||||
<!-- Open Graph image and Twitter Card meta-data -->
|
||||
<!-- OG/Twitter: Bild + Maße + Card (einheitlich, ohne Duplikate) -->
|
||||
{{ $image_path := .Params.image | default site.Params.image }}
|
||||
{{ $image_path_local := printf "assets/%s" $image_path }}
|
||||
{{ $image_path_local := printf "assets/%s" $image_path }}
|
||||
{{ $image_ext := trim (path.Ext $image_path | lower) "." }}
|
||||
|
||||
{{/* Titel & Beschreibung für OG/Twitter */}}
|
||||
{{ $ogt := cond .IsHome "Ingenieurbüro für PV, Speicher & Ladeinfrastruktur | AMPERION" (cond .Params.meta_title .Params.meta_title (printf "%s | AMPERION" .Title)) }}
|
||||
{{ $desc := .Params.meta_description | default site.Params.description }}
|
||||
|
||||
{{ $isArticle := in (slice "post" "posts" "blog" "blogs" "news") .Section }}
|
||||
<meta property="og:type" content="{{ if $isArticle }}article{{ else }}website{{ end }}">
|
||||
<meta property="og:url" content="{{ .Permalink }}">
|
||||
<meta property="og:title" content="{{ $ogt }}">
|
||||
{{ with $desc }}<meta property="og:description" content="{{ . | plainify }}">{{ end }}
|
||||
|
||||
{{ if fileExists $image_path_local }}
|
||||
<meta property="og:image" content="{{ $image_path | absURL }}" />
|
||||
<!-- If not SVG, read image aspect ratio and define Twitter Card and Open Graph width and height -->
|
||||
{{ if ne $image_ext "svg" }}
|
||||
{{ with (imageConfig $image_path_local) }}
|
||||
{{ if (and (gt .Width 144) (gt .Height 144)) }}
|
||||
<meta name="twitter:image" content="{{ $image_path | absURL }}" />
|
||||
<meta name="twitter:card"
|
||||
content="summary{{ if (and (gt .Width 300) (gt .Height 157) (not (eq .Width .Height))) }}_large_image{{ end }}">
|
||||
{{ end }}
|
||||
<meta property="og:image:width" content="{{ .Width }}">
|
||||
<meta property="og:image:height" content="{{ .Height }}">
|
||||
{{ end }}
|
||||
<meta property="og:image" content="{{ $image_path | absURL }}">
|
||||
{{ if ne $image_ext "svg" }}
|
||||
{{ with (imageConfig $image_path_local) }}
|
||||
{{ if (and (gt .Width 144) (gt .Height 144)) }}
|
||||
<meta name="twitter:image" content="{{ $image_path | absURL }}">
|
||||
{{ end }}
|
||||
<meta property="og:image:width" content="{{ .Width }}">
|
||||
<meta property="og:image:height" content="{{ .Height }}">
|
||||
{{ end }}
|
||||
{{ end }}
|
||||
{{ end }}
|
||||
|
||||
{{ end }}
|
||||
<meta name="twitter:card" content="summary_large_image">
|
||||
<meta name="twitter:title" content="{{ $ogt }}">
|
||||
{{ with $desc }}<meta name="twitter:description" content="{{ . | plainify }}">{{ end }}
|
||||
|
||||
{{ template "_internal/opengraph.html" . }}
|
||||
|
||||
<!-- AOS Animation CSS -->
|
||||
<link rel="stylesheet" href="https://unpkg.com/aos@next/dist/aos.css" />
|
||||
<!-- AOS CSS + Bootstrap (defer) -->
|
||||
<link rel="stylesheet" href="https://unpkg.com/aos@next/dist/aos.css">
|
||||
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/js/bootstrap.bundle.min.js" defer></script>
|
||||
|
||||
<!-- Hugo SCSS Pipeline mit Template-Parsing -->
|
||||
{{- $scss := resources.Get "scss/style.scss" | resources.ExecuteAsTemplate "scss/style.scss" . | toCSS (dict "targetPath" "css/style.css") | minify -}}
|
||||
<link rel="stylesheet" href="{{ $scss.RelPermalink }}">
|
||||
<!-- Styles: werden über partial "style.html" eingebunden (nicht hier erneut) -->
|
||||
|
||||
<!-- Strukturierte Daten: Organization -->
|
||||
{{ if templates.Exists "partials/ld-org.html" }}
|
||||
{{ partial "ld-org.html" . }}
|
||||
{{ end }}
|
||||
|
||||
|
||||
<!-- Matomo -->
|
||||
<script>
|
||||
var _paq = window._paq = window._paq || [];
|
||||
/* tracker methods like "setCustomDimension" should be called before "trackPageView" */
|
||||
_paq.push(['trackPageView']);
|
||||
_paq.push(['enableLinkTracking']);
|
||||
(function() {
|
||||
|
|
@ -92,4 +127,4 @@
|
|||
g.async=true; g.src=u+'matomo.js'; s.parentNode.insertBefore(g,s);
|
||||
})();
|
||||
</script>
|
||||
<!-- End Matomo Code -->
|
||||
<!-- End Matomo -->
|
||||
|
|
|
|||
26
layouts/partials/img.html
Normal file
26
layouts/partials/img.html
Normal 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 }}">
|
||||
26
layouts/partials/ld-org.html
Normal file
26
layouts/partials/ld-org.html
Normal file
|
|
@ -0,0 +1,26 @@
|
|||
{{- /* Organization JSON-LD — robust, nur Felder ausgeben, die vorhanden sind */ -}}
|
||||
{{- $logo := site.Params.logo | default site.Params.favicon | default site.Params.image | default "images/logo.webp" -}}
|
||||
{{- $email := site.Params.email | default "" -}}
|
||||
{{- $phone := site.Params.phone1 | default site.Params.phone | default "" -}}
|
||||
|
||||
<script type="application/ld+json">
|
||||
{
|
||||
"@context": "https://schema.org",
|
||||
"@type": "Organization",
|
||||
"name": "AMPERION GmbH",
|
||||
"url": {{ "/" | absURL | jsonify }},
|
||||
"logo": {{ ($logo | relURL | absURL) | jsonify }},
|
||||
"sameAs": [
|
||||
"https://www.linkedin.com/company/amperion-gmbh/",
|
||||
"https://www.instagram.com/amperion.at/",
|
||||
"https://www.facebook.com/share/1CZ7xm6cdw/?mibextid=wwXIfr"
|
||||
]{{ if or $email $phone }},
|
||||
"contactPoint": [{
|
||||
"@type": "ContactPoint",
|
||||
"contactType": "customer service"{{ if $phone }},
|
||||
"telephone": {{ $phone | jsonify }}{{ end }}{{ if $email }},
|
||||
"email": {{ $email | jsonify }}{{ end }},
|
||||
"areaServed": "AT"
|
||||
}]{{ end }}
|
||||
}
|
||||
</script>
|
||||
|
|
@ -80,16 +80,15 @@
|
|||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Content -->
|
||||
<!-- Content -->
|
||||
{{/* SEO: H1 steuerbar via .Params.h1, Fallback .Title; KEIN Untertitel mehr */}}
|
||||
{{ $h1 := .Params.h1 | default .Title }}
|
||||
<div class="container1">
|
||||
<div class="row">
|
||||
<div class="col-md-12 text-center">
|
||||
<div class="service-title">
|
||||
<h1 class="title-electric">{{ .Title }}</h1>
|
||||
<h1 class="title-electric" itemprop="headline" data-text="{{ $h1 }}">{{ $h1 }}</h1>
|
||||
</div>
|
||||
{{ with .Params.description }}
|
||||
<p class="page-title-desc">{{ . }}</p>
|
||||
{{ end }}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
@ -539,4 +538,4 @@
|
|||
opacity: 0.5;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
</style>
|
||||
|
|
|
|||
169
layouts/partials/related.html
Normal file
169
layouts/partials/related.html
Normal file
|
|
@ -0,0 +1,169 @@
|
|||
{{/* related.html (Enhanced UI + robust image fallback) */}}
|
||||
|
||||
{{ if not .IsHome }}
|
||||
{{ $page := . }}
|
||||
{{ $max := .Params.related_max | default 4 }}
|
||||
{{ $tags := .Params.tags | default (slice) }}
|
||||
{{ $exclude := .Params.related_exclude | default (slice) }}
|
||||
{{ $manual := .Params.related_manual | default (slice) }}
|
||||
{{ $pages := slice }}
|
||||
|
||||
{{/* Manuelle Auswahl? */}}
|
||||
{{ if gt (len $manual) 0 }}
|
||||
{{ range $manual }}
|
||||
{{ $p := site.GetPage . }}
|
||||
{{ if not $p }}{{ $p = site.GetPage (printf "/%s" (strings.TrimPrefix "/" .)) }}{{ end }}
|
||||
{{ if $p }}{{ $pages = $pages | append $p }}{{ end }}
|
||||
{{ end }}
|
||||
{{ $pages = first $max $pages }}
|
||||
{{ else }}
|
||||
{{/* Automatisch */}}
|
||||
{{ $recs := slice }}
|
||||
{{ range site.RegularPages }}
|
||||
{{ if or
|
||||
(eq .RelPermalink $page.RelPermalink)
|
||||
(in (slice "impressum" "datenschutz" "agb" "privacy") .Section)
|
||||
(in $exclude .RelPermalink)
|
||||
(in $exclude .File.TranslationBaseName)
|
||||
}}
|
||||
{{/* skip */}}
|
||||
{{ else }}
|
||||
{{ $candTags := .Params.tags | default (slice) }}
|
||||
{{ $tagScore := len (intersect $candTags $tags) }}
|
||||
|
||||
{{/* Sektion-Priorität */}}
|
||||
{{ $secScore := 0 }}
|
||||
{{ if eq $page.Section "leistungen" }}
|
||||
{{ if or (eq .Section "fokusthemen") (in (slice "post" "posts" "blog" "blogs" "news") .Section) }}{{ $secScore = 1 }}{{ end }}
|
||||
{{ else if or (eq $page.Section "fokusthemen") (eq $page.Section "themen") }}
|
||||
{{ if or (eq .Section "leistungen") (in (slice "post" "posts" "blog" "blogs" "news") .Section) }}{{ $secScore = 1 }}{{ end }}
|
||||
{{ else if in (slice "post" "posts" "blog" "blogs" "news") $page.Section }}
|
||||
{{ if or (eq .Section "leistungen") (eq .Section "fokusthemen") (eq .Section "themen") }}{{ $secScore = 1 }}{{ end }}
|
||||
{{ end }}
|
||||
|
||||
{{ $score := add (mul $tagScore 10) $secScore }}
|
||||
{{ if gt $score 0 }}
|
||||
{{ $recs = $recs | append (dict "p" . "s" $score "d" .Date) }}
|
||||
{{ end }}
|
||||
{{ end }}
|
||||
{{ end }}
|
||||
|
||||
{{ $recs = sort $recs "s" "desc" "d" "desc" }}
|
||||
{{ range first $max $recs }}
|
||||
{{ $pages = $pages | append .p }}
|
||||
{{ end }}
|
||||
{{ end }}
|
||||
|
||||
{{ if gt (len $pages) 0 }}
|
||||
<section class="related section" aria-label="Verwandte Inhalte">
|
||||
<div class="container my-container">
|
||||
<h3 class="related-title">Verwandte Inhalte</h3>
|
||||
|
||||
<div class="related-grid">
|
||||
{{ range $pages }}
|
||||
{{/* Sektion-Label */}}
|
||||
{{ $sec := .Section | default "" }}
|
||||
{{ $secLabel := "" }}
|
||||
{{ if eq $sec "leistungen" }}{{ $secLabel = "Leistungen" }}
|
||||
{{ else if or (eq $sec "fokusthemen") (eq $sec "themen") }}{{ $secLabel = "Fokusthemen" }}
|
||||
{{ else if or (eq $sec "post") (eq $sec "posts") (eq $sec "blog") (eq $sec "blogs") (eq $sec "news") }}{{ $secLabel = "Wissen" }}
|
||||
{{ else }}{{ $secLabel = (title $sec) }}{{ end }}
|
||||
|
||||
{{/* Robust: Thumb finden (card_image → image → images[0] → Auto-Discovery) */}}
|
||||
{{ $thumb := .Params.card_image | default .Params.image }}
|
||||
{{ if not $thumb }}
|
||||
{{ $imgs := .Params.images }}
|
||||
{{ if $imgs }}
|
||||
{{ $first := index $imgs 0 }}
|
||||
{{ if (reflect.IsMap $first) }}
|
||||
{{ $thumb = $first.src }}
|
||||
{{ else }}
|
||||
{{ $thumb = $first }}
|
||||
{{ end }}
|
||||
{{ end }}
|
||||
{{ end }}
|
||||
{{ if not $thumb }}
|
||||
{{ $slug := .Params.slug | default .File.TranslationBaseName }}
|
||||
{{ $cands := slice
|
||||
(printf "static/images/%s/%s1.webp" .Section $slug)
|
||||
(printf "static/images/leistungen/%s1.webp" $slug)
|
||||
(printf "static/images/fokusthemen/%s1.webp" $slug)
|
||||
(printf "static/images/%s1.webp" $slug)
|
||||
}}
|
||||
{{ range $cands }}
|
||||
{{ if and (not $thumb) (fileExists .) }}
|
||||
{{ $thumb = replace . "static" "" }}
|
||||
{{ end }}
|
||||
{{ end }}
|
||||
{{ end }}
|
||||
|
||||
<article class="related-item">
|
||||
<a class="related-link" href="{{ .RelPermalink }}">
|
||||
<div class="related-thumb-wrap">
|
||||
{{ if $thumb }}
|
||||
{{ partial "img.html" (dict
|
||||
"src" $thumb
|
||||
"alt" .Title
|
||||
"class" "related-thumb"
|
||||
"loading" "lazy"
|
||||
"page" $
|
||||
) }}
|
||||
{{ else }}
|
||||
<div class="related-thumb related-thumb--placeholder" aria-hidden="true">
|
||||
<svg viewBox="0 0 24 24" width="48" height="48">
|
||||
<path d="M21 19V5a2 2 0 0 0-2-2H5C3.9 3 3 3.9 3 5v14c0 1.1.9 2 2 2h14a2 2 0 0 0 2-2ZM8.5 13.5l2.5 3 3.5-4.5 4.5 6H5l3.5-4.5Z" fill="currentColor" opacity=".28"/>
|
||||
<circle cx="8" cy="8" r="2" fill="currentColor" opacity=".28"/>
|
||||
</svg>
|
||||
</div>
|
||||
{{ end }}
|
||||
{{ if $secLabel }}<span class="related-badge">{{ $secLabel }}</span>{{ end }}
|
||||
<span class="related-overlay" aria-hidden="true"></span>
|
||||
</div>
|
||||
<h4 class="related-name">{{ .Title }}</h4>
|
||||
</a>
|
||||
</article>
|
||||
{{ end }}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<style>
|
||||
.related-title{ text-align:center; margin:0 0 1.25rem }
|
||||
.related-grid{ display:grid; gap:16px; grid-template-columns:repeat(auto-fit,minmax(240px,1fr)) }
|
||||
|
||||
.related-item{ background:#fff; border-radius:14px; box-shadow:0 2px 12px rgba(0,0,0,.06); overflow:hidden; transition:transform .25s ease, box-shadow .25s ease }
|
||||
.related-link{ display:block; color:inherit; text-decoration:none; outline:none }
|
||||
.related-link:focus-visible{ box-shadow:0 0 0 3px rgba(4,110,110,.35) }
|
||||
|
||||
.related-thumb-wrap{ position:relative; aspect-ratio:16/9; overflow:hidden; background:#f3f3f3 }
|
||||
.related-thumb{ width:100%; height:100%; object-fit:cover; display:block; transition:transform .35s ease }
|
||||
.related-thumb--placeholder{ width:100%; height:100%; display:flex; align-items:center; justify-content:center; color:#9ca3af }
|
||||
|
||||
.related-badge{ position:absolute; left:12px; top:12px; padding:6px 10px; font-size:.75rem; border-radius:999px; background:rgba(4,110,110,.92); color:#fff; box-shadow:0 2px 8px rgba(0,0,0,.15) }
|
||||
.related-overlay{ position:absolute; inset:0; background:linear-gradient(180deg,rgba(0,0,0,0) 55%,rgba(0,0,0,.22)); opacity:0; transition:opacity .25s ease }
|
||||
|
||||
.related-item:hover .related-overlay{ opacity:1 }
|
||||
.related-item:hover{ transform:translateY(-2px); box-shadow:0 10px 28px rgba(0,0,0,.10) }
|
||||
.related-item:hover .related-thumb{ transform:scale(1.03) }
|
||||
|
||||
.related-name{ margin:12px 14px 16px; line-height:1.3 }
|
||||
|
||||
@media (max-width:640px){
|
||||
.related-grid{ gap:12px; grid-template-columns:1fr }
|
||||
.related-name{ margin:10px 12px 14px }
|
||||
.related-badge{ left:10px; top:10px; padding:5px 9px }
|
||||
}
|
||||
|
||||
@media (prefers-color-scheme:dark){
|
||||
.related-item{ background:#023d3d; box-shadow:0 2px 10px rgba(0,0,0,.4) }
|
||||
.related-thumb--placeholder{ background:#0b0f17; color:#6b7280 }
|
||||
.related-badge{ background:rgba(245,166,35,.95); color:#111 }
|
||||
.related-name{ color:#e5e7eb }
|
||||
}
|
||||
|
||||
@media (prefers-reduced-motion:reduce){
|
||||
.related-item, .related-thumb, .related-overlay{ transition:none !important }
|
||||
}
|
||||
</style>
|
||||
</section>
|
||||
{{ end }}
|
||||
{{ end }}
|
||||
|
|
@ -1,39 +1,14 @@
|
|||
{{- /* layouts/partials/seo.html */ -}}
|
||||
{{- $siteTitle := site.Title -}}
|
||||
{{- $sep := " | " -}}
|
||||
<title>
|
||||
{{- if .IsHome -}}
|
||||
AMPERION – Ingenieurbüro & Elektrotechnikbetrieb für Erneuerbare Energien
|
||||
{{- else -}}
|
||||
{{- .Title }}{{ $sep }}AMPERION – Photovoltaik, Energiespeicher, Ladeinfrastruktur
|
||||
{{- /* layouts/partials/seo.html — minimal & konfliktfrei */ -}}
|
||||
|
||||
{{- $desc := .Params.meta_description
|
||||
| default .Params.description
|
||||
| default .Description
|
||||
| default site.Params.default_meta_description
|
||||
| default site.Params.description
|
||||
| default (plainify (.Summary | default .Content)) -}}
|
||||
|
||||
<meta name="description" content="{{ $desc | plainify | truncate 155 }}">
|
||||
|
||||
{{- if or .Draft .Params.noindex -}}
|
||||
<meta name="robots" content="noindex,nofollow">
|
||||
{{- end -}}
|
||||
</title>
|
||||
|
||||
{{- $desc := cond (isset .Params "description") .Params.description
|
||||
"AMPERION ist Ihr staatlich geprüftes Ingenieurbüro & Elektrotechnikbetrieb: Planung, Projektmanagement & Consulting für Photovoltaik, Energiespeicher und Ladeinfrastruktur – von der Idee bis zur Inbetriebnahme." -}}
|
||||
<meta name="description" content="{{ $desc }}">
|
||||
|
||||
<link rel="canonical" href="{{ .Permalink }}">
|
||||
|
||||
{{- with .AlternativeOutputFormats }}{{ end -}}
|
||||
|
||||
{{- /* hreflang (de/en) */ -}}
|
||||
{{- range .AllTranslations -}}
|
||||
<link rel="alternate" hreflang="{{ .Language.Lang }}" href="{{ .Permalink }}">
|
||||
{{- end -}}
|
||||
<link rel="alternate" hreflang="x-default" href="{{ .Permalink }}">
|
||||
|
||||
<meta name="robots" content="index,follow">
|
||||
|
||||
<!-- Open Graph -->
|
||||
<meta property="og:type" content="{{ if .IsHome }}website{{ else }}article{{ end }}">
|
||||
<meta property="og:title" content="{{ if .IsHome }}AMPERION – Ingenieurbüro & Elektrotechnik{{ else }}{{ .Title }}{{ end }}">
|
||||
<meta property="og:description" content="{{ $desc }}">
|
||||
<meta property="og:url" content="{{ .Permalink }}">
|
||||
{{- $ogimg := (resources.Get "images/og-default.jpg") | default (resources.Get "images/logo.png") -}}
|
||||
{{- with $ogimg -}}{{ $p := .Fit "1200x630" }}<meta property="og:image" content="{{ $p.RelPermalink }}">{{ end -}}
|
||||
|
||||
<!-- Twitter -->
|
||||
<meta name="twitter:card" content="summary_large_image">
|
||||
<meta name="twitter:title" content="{{ if .IsHome }}AMPERION – Ingenieurbüro & Elektrotechnik{{ else }}{{ .Title }}{{ end }}">
|
||||
<meta name="twitter:description" content="{{ $desc }}">
|
||||
|
|
|
|||
|
|
@ -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 -}}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue