github.com/choria-io/go-choria@v0.28.1-0.20240416190746-b3bf9c7d5a45/docs/themes/hugo-theme-relearn/layouts/partials/breadcrumbs.html (about) 1 {{- $page := .page }} 2 {{- $to := $page }} 3 {{- $pageurl := partial "relLangPrettyUglyURL.hugo" (dict "to" $page) }} 4 {{- $lasturl := partial "relLangPrettyUglyURL.hugo" (dict "to" $page) }} 5 {{- if .dirOnly }} 6 {{- $page = $page.Parent }} 7 {{- $to = $page }} 8 {{- $lasturl = partial "relLangPrettyUglyURL.hugo" (dict "to" $page) }} 9 {{- end }} 10 {{- $depth := add 1 (int (partial "pageHelper/depth.hugo" (dict "page" $page))) }} 11 {{- if .page.Site.Params.disableRootBreadcrumb }} 12 {{- $depth = add $depth -1 }} 13 {{- end }} 14 {{- $breadcrumb := slice }} 15 {{- range seq $depth }} 16 {{- if $to }} 17 {{- if or $to.Title (eq $to.Kind "taxonomy") (eq $to.Kind "term") }} 18 {{- $breadcrumb = $breadcrumb | append $to }} 19 {{- end }} 20 {{- else }} 21 {{- break }} 22 {{- end }} 23 {{- $to = $to.Parent }} 24 {{- end }} 25 {{- $len := len $breadcrumb -}} 26 {{- $breadcrumbReversed := slice }} 27 {{- range seq $len }} 28 {{- $breadcrumbReversed = $breadcrumbReversed | append (index $breadcrumb (sub $len .)) }} 29 {{- end }} 30 {{- $depth := 0 }} 31 {{- range $i, $e := $breadcrumbReversed }} 32 {{- $to := $e }} 33 {{- $depth = add $depth 1 }} 34 {{- $title := partial "pageHelper/title.hugo" (dict "page" $to "linkTitle" true) }} 35 {{- $url := partial "relLangPrettyUglyURL.hugo" (dict "to" $to) }} 36 {{- $isPage := eq $url $pageurl }} 37 {{- $isLast := eq $url $lasturl }} 38 {{- $link := and $url (not $isPage) }} 39 {{- printf "<li" | safeHTML }} 40 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> 41 {{- end }}