chill_hugoplate/layouts/partials/components/breadcrumb.html
2023-06-04 13:29:21 +06:00

36 lines
1.0 KiB
HTML

{{ $context := .Context }}
{{ $class := .Class }}
{{ $base := site.BaseURL }}
{{ $url := replace $context.Permalink ( printf "%s" $base) "" }}
{{ $lang := $context.Lang }}
{{ $.Scratch.Add "path" $base }}
<ul class="{{ $class }} inline-flex">
<li class="mx-1 capitalize">
<a
class="text-primary dark:text-darkmode-primary"
href="{{ $base | relLangURL }}">
{{ i18n "home" | default "Home" }}
</a>
</li>
{{ range $index, $element := split $url "/" }}
{{ if ne $element $lang }}
{{ $.Scratch.Add "path" $element }}
{{ else }}
{{ $.Scratch.Add "path" (add $element "/") }}
{{ end }}
{{ if and (ne $element "") (ne $element $lang) }}
<li class="text-light dark:text-darkmode-light mx-1 capitalize">
<span class="inlin-block mr-1">/</span>
<a
class="text-primary dark:text-darkmode-primary"
href="{{ $.Scratch.Get `path` }}"
>{{ . }}
</a>
</li>
{{ $.Scratch.Add "path" "/" }}
{{ end }}
{{ end }}
</ul>