diff options
| author | Danilo M. <danix@danix.xyz> | 2026-04-22 10:45:03 +0200 |
|---|---|---|
| committer | Danilo M. <danix@danix.xyz> | 2026-04-22 10:45:03 +0200 |
| commit | 185b52a338caecc802e751e9c54c58155f984f01 (patch) | |
| tree | f5ad2b8a95f6e9637554d4aba3e0dbf66d53c199 /themes/danix-xyz-hacker/layouts | |
| parent | 686cb366f696c6d684e3e9ec2dc26d6c6caadf75 (diff) | |
| download | danixxyz-185b52a338caecc802e751e9c54c58155f984f01.tar.gz danixxyz-185b52a338caecc802e751e9c54c58155f984f01.zip | |
feat: add Breadcrumb JSON-LD structured data to single pages
- 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 <noreply@anthropic.com>
Diffstat (limited to 'themes/danix-xyz-hacker/layouts')
| -rw-r--r-- | themes/danix-xyz-hacker/layouts/partials/breadcrumb-jsonld.html | 33 | ||||
| -rw-r--r-- | themes/danix-xyz-hacker/layouts/partials/head-meta.html | 3 |
2 files changed, 36 insertions, 0 deletions
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 index 0000000..3f873a0 --- /dev/null +++ b/themes/danix-xyz-hacker/layouts/partials/breadcrumb-jsonld.html @@ -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> diff --git a/themes/danix-xyz-hacker/layouts/partials/head-meta.html b/themes/danix-xyz-hacker/layouts/partials/head-meta.html index 45fd476..89b5d50 100644 --- a/themes/danix-xyz-hacker/layouts/partials/head-meta.html +++ b/themes/danix-xyz-hacker/layouts/partials/head-meta.html @@ -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 }} |
