{{ $url := replace .RelPermalink ( printf "%s" .Site.BaseURL) "" }} {{ $.Scratch.Add "path2" .Site.BaseURL }} {{ $indexmax := 0 }} {{ $.Scratch.Add "siteBreadcrumbs" (slice (dict "url" .Site.BaseURL "name" "home" "position" 1 )) }} {{ range $index, $element := split $url "/" }} {{ $.Scratch.Add "path2" $element }} {{ if ne $element "" }} {{ $.Scratch.Add "siteBreadcrumbs" (slice (dict "url" ($.Scratch.Get "path2") "name" . "position" (add $index 1))) }} {{ $indexmax = add $indexmax 1 }} {{ $.Scratch.Add "path2" "/" }} {{ end }} {{ end }} {{ range $.Scratch.Get "siteBreadcrumbs" }} {{ if eq .position $indexmax }} {{ end }} {{ end }}