You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
29 lines
901 B
29 lines
901 B
{{- $breadcrumbs := slice }}
|
|
{{- $path := .page.RelPermalink }}
|
|
{{- $path = trim $path "/" }}
|
|
{{- $currentPath := "" }}
|
|
{{- range split $path "/" }}
|
|
{{- $currentPath = printf "%s/%s" $currentPath . }}
|
|
{{- $page := $.page.GetPage $currentPath }}
|
|
{{- if ne (trim $currentPath "/") $path }}
|
|
{{- $title := $page.Title }}
|
|
{{- with $page.Params.breadcrumb }}
|
|
{{- $title = . }}
|
|
{{- end }}
|
|
{{- $breadcrumbs = $breadcrumbs | append (dict "name" $title "url" $page.Permalink) }}
|
|
{{- end }}
|
|
{{- end }}
|
|
{{- $breadcrumbs = after (int .page.IsPage) $breadcrumbs}}
|
|
{{- if ne .page.Type "page"}}
|
|
{{- if lt (default 0 .min) (len $breadcrumbs) }}
|
|
<nav aria-label="breadcrumb" class="breadcrumbs">
|
|
<ol>
|
|
{{- range $index, $breadcrumb := $breadcrumbs }}
|
|
<li>
|
|
<a href="{{ $breadcrumb.url }}">{{ $breadcrumb.name }}</a>
|
|
</li>
|
|
{{- end }}
|
|
</ol>
|
|
</nav>
|
|
{{- end }}
|
|
{{- end }}
|
|
|