hugo-typo/layouts/partials/breadcrumbs.html
Sangeeth Sudheer 5bbe13fd43
Add breadcrumbs config to hide current page and change home text
Changes `breadcrumbs` config into an object to add customizations such as hiding current page and changing the text of
the home crumb.

By default, Typo will now show breadcrumbs. If breadcrumbs are enabled, the current default of showing the
current page crumb is preserved.

BREAKING CHANGE: `breadcrumbs` is now an object so existing `breadcrumbs = <true/false>` line in config needs to be changed.
2025-03-09 01:50:55 +05:30

23 lines
No EOL
745 B
HTML

{{- if .Site.Params.breadcrumbs.enabled -}}
{{- $breadcrumbs := .Site.Params.breadcrumbs -}}
<div class="breadcrumbs">
{{- range $i, $v := .Ancestors.Reverse -}}
<a href="{{ .RelPermalink }}">
{{- if (and (eq $i 0) (ne $breadcrumbs.home "")) -}}
{{- $breadcrumbs.home -}}
{{- else -}}
{{- .Title -}}
{{- end -}}
</a>
{{- if (lt $i (sub $.Ancestors.Len 1)) -}}
<span class="breadcrumbs-separator">/</span>
{{- end -}}
{{- end -}}
{{- if $breadcrumbs.showCurrentPage -}}
<span class="breadcrumbs-separator">/</span>
<a href="{{ .RelPermalink }}">{{ .Title }}</a>
{{- end -}}
</div>
{{- end -}}