summaryrefslogtreecommitdiffstats
path: root/layouts/partials/breadcrumb-jsonld.html
diff options
context:
space:
mode:
Diffstat (limited to 'layouts/partials/breadcrumb-jsonld.html')
-rw-r--r--layouts/partials/breadcrumb-jsonld.html36
1 files changed, 36 insertions, 0 deletions
diff --git a/layouts/partials/breadcrumb-jsonld.html b/layouts/partials/breadcrumb-jsonld.html
new file mode 100644
index 0000000..95b5e69
--- /dev/null
+++ b/layouts/partials/breadcrumb-jsonld.html
@@ -0,0 +1,36 @@
+{{- $homeURL := absURL "/" -}}
+{{- $homeName := i18n "home" -}}
+{{- if eq .Lang "it" -}}
+ {{- $homeURL = absURL "/it/" -}}
+{{- end -}}
+<script type="application/ld+json">
+{
+ "@context": "https://schema.org",
+ "@type": "BreadcrumbList",
+ "itemListElement": [
+ {
+ "@type": "ListItem",
+ "position": 1,
+ "name": "{{ $homeName }}",
+ "item": "{{ $homeURL }}"
+ }
+ {{- $pos := 1 -}}
+ {{- range .Ancestors.Reverse -}}
+ {{- if ne .Kind "home" -}}
+ {{- $pos = add $pos 1 -}}
+ ,{
+ "@type": "ListItem",
+ "position": {{ $pos }},
+ "name": "{{ .Title }}",
+ "item": "{{ .Permalink }}"
+ }
+ {{- end -}}
+ {{- end -}}
+ ,{
+ "@type": "ListItem",
+ "position": {{ add $pos 1 }},
+ "name": "{{ .Title }}"
+ }
+ ]
+}
+</script>