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 }}
|
||||
Loading…
Add table
Add a link
Reference in a new issue