2023-09-23 22:27:39 +00:00
|
|
|
{{- $page := .page }}
|
|
|
|
{{- $to := $page }}
|
|
|
|
{{- $pageurl := partial "relLangPrettyUglyURL.hugo" (dict "to" $page) }}
|
|
|
|
{{- $lasturl := partial "relLangPrettyUglyURL.hugo" (dict "to" $page) }}
|
|
|
|
{{- if .dirOnly }}
|
|
|
|
{{- $page = $page.Parent }}
|
|
|
|
{{- $to = $page }}
|
|
|
|
{{- $lasturl = partial "relLangPrettyUglyURL.hugo" (dict "to" $page) }}
|
|
|
|
{{- end }}
|
|
|
|
{{- $depth := add 1 (int (partial "get-page-depth.hugo" (dict "page" $page))) }}
|
|
|
|
{{- if .page.Site.Params.disableRootBreadcrumb }}
|
|
|
|
{{- $depth = add $depth -1 }}
|
|
|
|
{{- end }}
|
|
|
|
{{- $breadcrumb := slice }}
|
|
|
|
{{- range seq $depth }}
|
|
|
|
{{- if $to }}
|
2023-11-03 22:31:49 +00:00
|
|
|
{{- if or $to.Title (eq $to.Kind "taxonomy") (eq $to.Kind "term") }}
|
2023-09-23 22:27:39 +00: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 20:25:47 +00:00
|
|
|
{{- $depth := 0 }}
|
2023-09-23 22:27:39 +00:00
|
|
|
{{- range $i, $e := $breadcrumbReversed }}
|
|
|
|
{{- $to := $e }}
|
2023-09-26 20:25:47 +00:00
|
|
|
{{- $depth = add $depth 1 }}
|
2023-09-23 22:27:39 +00:00
|
|
|
{{- $title := $to.Title }}
|
2023-10-28 22:03:19 +00:00
|
|
|
{{- if eq $to.Kind "taxonomy" }}
|
2023-11-03 22:31:49 +00:00
|
|
|
{{- $title = default (default $to.Data.Plural (i18n $to.Data.Plural)) .Title }}
|
2023-10-28 22:03:19 +00:00
|
|
|
{{- else if eq $to.Kind "term" }}
|
2023-11-03 22:31:49 +00:00
|
|
|
{{- $taxonomy_page := $to.Site.GetPage $to.Data.Plural }}
|
|
|
|
{{- $title = default (default $to.Data.Singular (i18n $to.Data.Singular)) $taxonomy_page.Params.SingularTitle }}
|
2023-11-03 23:37:24 +00:00
|
|
|
{{- $title = printf "%s %s %s" $title (default "::" $to.Site.Params.titleSeparator) (default (humanize $to.Data.Term) $to.Title) }}
|
2023-09-23 22:27:39 +00:00
|
|
|
{{- end }}
|
|
|
|
{{- if not $title }}
|
|
|
|
{{- $title = $to.Site.Title }}
|
|
|
|
{{- end }}
|
|
|
|
{{- $url := partial "relLangPrettyUglyURL.hugo" (dict "to" $to) }}
|
|
|
|
{{- $isPage := eq $url $pageurl }}
|
|
|
|
{{- $isLast := eq $url $lasturl }}
|
|
|
|
{{- $link := and $url (not $isPage) }}
|
|
|
|
{{- printf "<li" | safeHTML }}
|
|
|
|
itemscope itemtype="https://schema.org/ListItem" itemprop="itemListElement">{{ if $link }}<a itemprop="item" href="{{ $url }}">{{end}}<span itemprop="name">{{ $title }}</span>{{ if $link }}</a>{{ end }}<meta itemprop="position" content="{{ $depth }}">{{ if not $isLast }}{{ (printf " %s " (default ">" .Site.Params.breadcrumbSeparator)) | safeHTML }}{{ end }}</li>
|
|
|
|
{{- end }}
|