summaryrefslogtreecommitdiffstats
path: root/themes
diff options
context:
space:
mode:
Diffstat (limited to 'themes')
-rw-r--r--themes/danix-xyz-hacker/layouts/partials/breadcrumb-jsonld.html25
-rw-r--r--themes/danix-xyz-hacker/layouts/partials/breadcrumb.html10
2 files changed, 20 insertions, 15 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 }}"
}
]
diff --git a/themes/danix-xyz-hacker/layouts/partials/breadcrumb.html b/themes/danix-xyz-hacker/layouts/partials/breadcrumb.html
index aa7c1e8..c15dfeb 100644
--- a/themes/danix-xyz-hacker/layouts/partials/breadcrumb.html
+++ b/themes/danix-xyz-hacker/layouts/partials/breadcrumb.html
@@ -1,14 +1,16 @@
{{ $homeLink := "/" }}
-{{ $articlesLink := "/articles/" }}
{{ if eq .Lang "it" }}
{{ $homeLink = "/it/" }}
- {{ $articlesLink = "/it/articles/" }}
{{ end }}
<nav class="breadcrumb mb-6" aria-label="Breadcrumb">
<a href="{{ $homeLink }}">{{ i18n "home" }}</a>
- <span class="breadcrumb-separator">/</span>
- <a href="{{ $articlesLink }}">{{ i18n "articles" }}</a>
+ {{ range .Ancestors.Reverse }}
+ {{ if ne .Kind "home" }}
+ <span class="breadcrumb-separator">/</span>
+ <a href="{{ .RelPermalink }}">{{ .Title }}</a>
+ {{ end }}
+ {{ end }}
<span class="breadcrumb-separator">/</span>
<span>{{ .Title }}</span>
</nav>