19 lines
683 B
HTML
19 lines
683 B
HTML
{{ $siteUrl := replace .Permalink ( printf "%s" .Site.BaseURL) "" }}
|
|
{{ $.Scratch.Add "sitePath" .Site.BaseURL }}
|
|
|
|
{{ $.Scratch.Add "siteBreadcrumbs" (slice (dict "url" .Site.BaseURL "name" "home" "position" 1 )) }}
|
|
{{ range $index, $element := split $siteUrl "/" }}
|
|
{{ $.Scratch.Add "sitePath" $element }}
|
|
{{ $.Scratch.Add "sitePath" "/" }}
|
|
{{ if ne $element "" }}
|
|
{{ $.Scratch.Add "siteBreadcrumbs" (slice (dict "url" ($.Scratch.Get "sitePath") "name" . "position" (add $index 2))) }}
|
|
{{ end }}
|
|
{{ end }}
|
|
|
|
<nav class="breadcrumbs">
|
|
<ul>
|
|
{{ range $.Scratch.Get "siteBreadcrumbs" }}
|
|
<li><a href="{{ .url }}">{{ .name }}</a></li>
|
|
{{ end }}
|
|
</ul>
|
|
</nav> |