2023-09-24 00:27:39 +02:00
{{- $page := .page }}
{{- $to := $page }}
2024-08-29 12:28:34 +02:00
{{- $pageurl := partial "permalink.gotmpl" (dict "to" $page) }}
{{- $lasturl := partial "permalink.gotmpl" (dict "to" $page) }}
2023-09-24 00:27:39 +02:00
{{- if .dirOnly }}
{{- $page = $page.Parent }}
{{- $to = $page }}
2024-08-29 12:28:34 +02:00
{{- $lasturl = partial "permalink.gotmpl" (dict "to" $page) }}
2023-09-24 00:27:39 +02:00
{{- end }}
2024-08-29 12:28:34 +02:00
{{- $depth := add 1 (int (partial "_relearn/pageDepth.gotmpl" (dict "page" $page))) }}
2023-09-24 00:27:39 +02:00
{{- $breadcrumb := slice }}
{{- range seq $depth }}
{{- if $to }}
2025-02-17 19:54:51 +01:00
{{- $title := partial "title.gotmpl" (dict "page" $to "linkTitle" true) }}
2024-08-29 12:28:34 +02:00
{{- if partial "_relearn/pageIsSpecial.gotmpl" $to }}
2024-08-27 15:34:36 +02:00
{{- break }}
2025-02-17 19:54:51 +01:00
{{- else if or $title (eq $to.Kind "taxonomy") (eq $to.Kind "term") }}
2023-09-24 00:27:39 +02:00
{{- $breadcrumb = $breadcrumb | append $to }}
{{- end }}
{{- else }}
{{- break }}
{{- end }}
{{- $to = $to.Parent }}
{{- end }}
{{- $len := len $breadcrumb -}}
{{- $breadcrumbReversed := slice }}
{{- range seq $len }}
{{- $breadcrumbReversed = $breadcrumbReversed | append (index $breadcrumb (sub $len .)) }}
{{- end }}
2023-09-26 22:25:47 +02:00
{{- $depth := 0 }}
2023-09-24 00:27:39 +02:00
{{- range $i, $e := $breadcrumbReversed }}
{{- $to := $e }}
2023-09-26 22:25:47 +02:00
{{- $depth = add $depth 1 }}
2025-02-16 21:29:54 +01:00
{{- $class := "" }}
{{- if and (eq $depth 1) site.Params.disableRootBreadcrumb }}
{{- $class = "a11y-only" }}
{{- end }}
2024-08-29 12:28:34 +02:00
{{- $title := partial "title.gotmpl" (dict "page" $to "linkTitle" true) }}
{{- $url := partial "permalink.gotmpl" (dict "to" $to) }}
2023-09-24 00:27:39 +02:00
{{- $isPage := eq $url $pageurl }}
{{- $isLast := eq $url $lasturl }}
{{- $link := and $url (not $isPage) }}
2025-02-16 21:29:54 +01:00
{{- if or $.schema (not $class) }}
< li { { if $ . schema } } itemscope itemtype = "https://schema.org/ListItem" itemprop = "itemListElement" { { end } } class = "{{ $class | safeHTMLAttr }}" > {{ if $link }}< a { { if $ . schema } } itemprop = "item" { { end } } href = "{{ $url }}" > {{end}}< span { { if $ . schema } } itemprop = "name" { { end } } > {{ $title }}< / span > {{ if $link }}< / a > {{ end }}{{ if $.schema }}< meta itemprop = "position" content = "{{ $depth }}" > {{ end }}{{ if not $isLast }}{{ (printf " %s " (default ">" .Site.Params.breadcrumbSeparator)) | safeHTML }}{{ end }}< / li >
{{- end }}
2023-09-24 00:27:39 +02:00
{{- end }}