]> danix's work - danix.xyz-2.git/commitdiff
feat: add Breadcrumb JSON-LD structured data to single pages
authorDanilo M. <redacted>
Wed, 22 Apr 2026 08:45:03 +0000 (10:45 +0200)
committerDanilo M. <redacted>
Wed, 22 Apr 2026 08:45:03 +0000 (10:45 +0200)
- New partial: breadcrumb-jsonld.html generates BreadcrumbList schema
- Integrated into head-meta.html for single content pages only
- i18n aware: Italian uses /it/ prefix, localized "Home"/"Articoli"
- No JSON-LD on homepage or list pages (Kind="page" guard)
- Valid JSON schema per https://schema.org/BreadcrumbList
- Fixes TODO.md:30

Co-Authored-By: Claude Haiku 4.5 <redacted>
themes/danix-xyz-hacker/layouts/partials/breadcrumb-jsonld.html [new file with mode: 0644]
themes/danix-xyz-hacker/layouts/partials/head-meta.html

diff --git a/themes/danix-xyz-hacker/layouts/partials/breadcrumb-jsonld.html b/themes/danix-xyz-hacker/layouts/partials/breadcrumb-jsonld.html
new file mode 100644 (file)
index 0000000..3f873a0
--- /dev/null
@@ -0,0 +1,33 @@
+{{- $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">
+{
+  "@context": "https://schema.org",
+  "@type": "BreadcrumbList",
+  "itemListElement": [
+    {
+      "@type": "ListItem",
+      "position": 1,
+      "name": "{{ $homeName }}",
+      "item": "{{ $homeURL }}"
+    },
+    {
+      "@type": "ListItem",
+      "position": 2,
+      "name": "{{ $articlesName }}",
+      "item": "{{ $articlesURL }}"
+    },
+    {
+      "@type": "ListItem",
+      "position": 3,
+      "name": "{{ .Title }}"
+    }
+  ]
+}
+</script>
index 45fd476bc358d21bf2a6232a209a781fa5f17e3d..89b5d5075c35ff9718590c278b5ae81811936379 100644 (file)
@@ -52,3 +52,6 @@
 <link rel="alternate" hreflang="x-default" href="{{ .Permalink }}">
   {{ end }}
 {{ end }}
+
+{{/* Structured data: BreadcrumbList JSON-LD (single content pages only) */}}
+{{ if eq .Kind "page" }}{{ partial "breadcrumb-jsonld.html" . }}{{ end }}