summaryrefslogtreecommitdiffstats
path: root/themes/danix-xyz-hacker/layouts/partials/breadcrumb-jsonld.html
diff options
context:
space:
mode:
authorDanilo M. <danix@danix.xyz>2026-04-22 11:48:19 +0200
committerDanilo M. <danix@danix.xyz>2026-04-22 11:48:19 +0200
commitdfa654ef8c1128e0f09dc269e3643d73ac3fa69d (patch)
tree1b9bca22df92e260145d4e0ebcc13ebd9081b578 /themes/danix-xyz-hacker/layouts/partials/breadcrumb-jsonld.html
parent3e568636ea564606abddcd05288d06e036a5efe4 (diff)
downloaddanixxyz-dfa654ef8c1128e0f09dc269e3643d73ac3fa69d.tar.gz
danixxyz-dfa654ef8c1128e0f09dc269e3643d73ac3fa69d.zip
fix: breadcrumb uses actual page ancestors instead of hardcoded articles path
Static pages under /is/ now show correct breadcrumb trail (eg. Home / About / Privacy). Articles still show Home / Articles / Title. Both HTML breadcrumb and JSON-LD structured data updated.
Diffstat (limited to 'themes/danix-xyz-hacker/layouts/partials/breadcrumb-jsonld.html')
-rw-r--r--themes/danix-xyz-hacker/layouts/partials/breadcrumb-jsonld.html25
1 files changed, 14 insertions, 11 deletions
diff --git a/themes/danix-xyz-hacker/layouts/partials/breadcrumb-jsonld.html b/themes/danix-xyz-hacker/layouts/partials/breadcrumb-jsonld.html
index 3f873a0..95b5e69 100644
--- a/themes/danix-xyz-hacker/layouts/partials/breadcrumb-jsonld.html
+++ b/themes/danix-xyz-hacker/layouts/partials/breadcrumb-jsonld.html
@@ -1,10 +1,7 @@
{{- $homeURL := absURL "/" -}}
-{{- $articlesURL := absURL "/articles/" -}}
{{- $homeName := i18n "home" -}}
-{{- $articlesName := i18n "articles" -}}
{{- if eq .Lang "it" -}}
{{- $homeURL = absURL "/it/" -}}
- {{- $articlesURL = absURL "/it/articles/" -}}
{{- end -}}
<script type="application/ld+json">
{
@@ -16,16 +13,22 @@
"position": 1,
"name": "{{ $homeName }}",
"item": "{{ $homeURL }}"
- },
- {
+ }
+ {{- $pos := 1 -}}
+ {{- range .Ancestors.Reverse -}}
+ {{- if ne .Kind "home" -}}
+ {{- $pos = add $pos 1 -}}
+ ,{
"@type": "ListItem",
- "position": 2,
- "name": "{{ $articlesName }}",
- "item": "{{ $articlesURL }}"
- },
- {
+ "position": {{ $pos }},
+ "name": "{{ .Title }}",
+ "item": "{{ .Permalink }}"
+ }
+ {{- end -}}
+ {{- end -}}
+ ,{
"@type": "ListItem",
- "position": 3,
+ "position": {{ add $pos 1 }},
"name": "{{ .Title }}"
}
]