<!--
<div role="navigation" aria-label="breadcrumbs navigation">
    {{ $url := replace .Permalink ( printf "%s" .Site.BaseURL) "" }}
    {{ $.Scratch.Add "path" .Site.BaseURL }}
    {{ $.Scratch.Add "currentURL" .URL }}
    {{ $pageNotFound := (eq (replace $.Site.BaseURL .Site.BaseURL "404.html") .URL) }}
    <ul class="breadcrumbs">
        {{ range $index, $element := split $url "/" }}
        {{ $.Scratch.Add "path" $element }}
        {{ $.Scratch.Add "path" "/" }}
        &lt;!&ndash; Check if the current list item is the last one &ndash;&gt;
        {{ $isLast := eq ($.Scratch.Get "path") $.Permalink }}

        {{ if ne $element "" }}
        {{ if and (not $isLast) (not $pageNotFound) }}
        <li><a href='{{ $.Scratch.Get "path" }}'>{{ title ( replace . "-" " ") }}</a> &rsaquo;</li>
        {{ else if $pageNotFound }}
        <li>404</li>
        {{ else }}
        <li>{{ $.Title }}</li>
        {{ end }}
        {{ end }}
        {{ end }}
    </ul>
</div>
-->

<ul class="breadcrumbs">
    {{ template "breadcrumb" dict "currentPage" .Page "id" .UniqueID }}
</ul>

<!-- templates -->
{{ define "breadcrumb" }}
    {{ if .currentPage.Parent }}
        {{ template "breadcrumb" dict "currentPage" .currentPage.Parent }}
    {{ end }}
    {{ $title := cond (eq .currentPage.RelPermalink "/docs/" ) "Docs" (title .currentPage.Title) }}
    {{ if (ne .currentPage.Parent .IsHome) }}
        <li>
            {{ if eq .id .currentPage.UniqueID }}
                {{ $title }}
            {{ else }}
                <a href="{{ .currentPage.RelPermalink  }}">{{ $title }}</a>
            {{ end }}
        </li>
    {{ end }}
{{ end }}
