blob: b5ac4600dda4b315ef270f85a8bcb7bfca448b57 [file] [log] [blame]
{{ $.Scratch.Set "breadcrumb_path" "/" }}
{{ $.Scratch.Set "url" (replace .Permalink ( printf "%s" .Site.BaseURL) "") }}
{{ $latestChar := substr ($.Scratch.Get "url") (sub (len ($.Scratch.Get "url")) 1) }}
{{ if eq $latestChar "/" }}
{{ $newUrl := substr ($.Scratch.Get "url") 0 (sub (len ($.Scratch.Get "url")) 1) }}
{{ $.Scratch.Set "url" $newUrl }}
{{ end }}
<ol class="breadcrumb mt-4 p-2 bg-body-tertiary">
{{ $splittedUrl := split ($.Scratch.Get "url") "/" }}
{{ range $index, $element := $splittedUrl }}
{{ $.Scratch.Add "breadcrumb_path" $element }}
{{ if ne $element "" }}
{{ if eq $index (sub (len $splittedUrl) 1) }}
<li class="breadcrumb-item active">{{ upper (replace (humanize .) ".html" "") }}</li>
{{ else }}
<li class="breadcrumb-item"><a href='{{ $.Scratch.Get "breadcrumb_path" }}'>{{ upper (replace (humanize .) ".html" "") }}</a></li>
{{ end }}
{{ $.Scratch.Add "breadcrumb_path" "/" }}
{{ end }}
{{ end }}
</ol>
{{ $.Scratch.Delete "breadcrumb_path" }}
{{ $.Scratch.Delete "url" }}