<section id="breadcrumb-bar" class="breadcrumb-bar container">
    <nav aria-label="breadcrumb" class="d-print-none">
        <ol class="breadcrumbs">
            <li class="breadcrumb-item">
                <a href="{{ relURL "" }}" class="breadcrumb-link">
                    <span class="breadcrumb-icon" aria-hidden="true">🏠</span>
                    <span class="breadcrumb-text">Home</span>
                </a>
            </li>
            {{- $.Scratch.Set "url" "" -}}
            {{- $taxonomy := .Data.Plural -}}
            {{- range $index, $element := (split (trim .RelPermalink "/") "/") -}}
            {{- $.Scratch.Add "url" (print "/" . ) -}}
            {{- if eq $index 0 -}}
            {{- if eq . "tags" -}}
            <li class="breadcrumb-item">
                <a href="{{ $.Scratch.Get `url` }}" class="breadcrumb-link">
                    <span class="breadcrumb-text">Tags</span>
                </a>
            </li>
            {{- else if eq . "categories" -}}
            <li class="breadcrumb-item">
                <a href="{{ $.Scratch.Get `url` }}" class="breadcrumb-link">
                    <span class="breadcrumb-text">Categories</span>
                </a>
            </li>
            {{- else -}}
            {{- $section := $.Site.GetPage "section" . -}}
            {{- if $section -}}
            <li class="breadcrumb-item">
                <a href="{{ $.Scratch.Get `url` }}" class="breadcrumb-link">
                    <span class="breadcrumb-text">{{ $section.Title }}</span>
                </a>
            </li>
            {{- else -}}
            <li class="breadcrumb-item">
                <a href="{{ $.Scratch.Get `url` }}" class="breadcrumb-link">
                    <span class="breadcrumb-text">{{ humanize . }}</span>
                </a>
            </li>
            {{- end -}}
            {{- end -}}
            {{- else -}}
            {{- if eq $taxonomy "tags" -}}
            <li class="breadcrumb-item active" aria-current="page">
                <span class="breadcrumb-text">{{ humanize . }}</span>
            </li>
            {{- else if eq $taxonomy "categories" -}}
            <li class="breadcrumb-item active" aria-current="page">
                <span class="breadcrumb-text">{{ humanize . }}</span>
            </li>
            {{- else -}}
            {{- $currentPage := $.Site.GetPage ($.Scratch.Get "url") -}}
            {{- if $currentPage -}}
            {{- if $currentPage.IsPage -}}
            <li class="breadcrumb-item active" aria-current="page">
                <span class="breadcrumb-text">{{ $currentPage.Title }}</span>
            </li>
            {{- else -}}
            <li class="breadcrumb-item">
                <a href="{{ $.Scratch.Get `url` }}" class="breadcrumb-link">
                    <span class="breadcrumb-text">{{ $currentPage.Title }}</span>
                </a>
            </li>
            {{- end -}}
            {{- else -}}
            <li class="breadcrumb-item">
                <a href="{{ $.Scratch.Get `url` }}" class="breadcrumb-link">
                    <span class="breadcrumb-text">{{ humanize . }}</span>
                </a>
            </li>
            {{- end -}}
            {{- end -}}
            {{- end -}}
            {{- end -}}
        </ol>
    </nav>
</section>