chill_hugoplate/layouts/partials/components/breadcrumb.html

36 lines
1.0 KiB
HTML
Raw Normal View History

2023-06-04 07:29:21 +00:00
{{ $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">
2023-06-04 05:07:38 +00:00
<li class="mx-1 capitalize">
2023-06-04 07:29:21 +00:00
<a
class="text-primary dark:text-darkmode-primary"
href="{{ $base | relLangURL }}">
{{ i18n "home" | default "Home" }}
</a>
2023-06-04 05:07:38 +00:00
</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>