diff options
author | Francesco Tomaselli <tomaselli.fr@gmail.com> | 2025-03-14 21:06:32 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2025-03-14 21:06:32 +0100 |
commit | 871bb0c8f9c3915e8b1aed1363eaed91560e69fb (patch) | |
tree | 1e63ad8e15d97fb12149ff7fef1c0c9a776a5ce7 /layouts | |
parent | 46999d3c4872fa9072bdde3b035cc18a7f08a76d (diff) | |
parent | c7188632b728bff9caf3bb0b9746e662f2eddee1 (diff) |
Merge pull request #95 from runofthemillgeek/feat/breadcrumbs-customization
Add breadcrumbs config to hide current page and change home text
Diffstat (limited to 'layouts')
-rw-r--r-- | layouts/partials/breadcrumbs.html | 28 |
1 files changed, 21 insertions, 7 deletions
diff --git a/layouts/partials/breadcrumbs.html b/layouts/partials/breadcrumbs.html index 5c4fb62..df67cb8 100644 --- a/layouts/partials/breadcrumbs.html +++ b/layouts/partials/breadcrumbs.html @@ -1,9 +1,23 @@ -{{ if .Site.Params.breadcrumbs }} +{{- if .Site.Params.breadcrumbs.enabled -}} +{{- $breadcrumbs := .Site.Params.breadcrumbs -}} <div class="breadcrumbs"> - {{ range .Ancestors.Reverse }} - <a href="{{ .RelPermalink }}">{{ .Title }}</a> - <span class="breadcrumbs-separator"> / </span> - {{ end }} - <a href="{{ .RelPermalink }}">{{ .Title }}</a> + {{- 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 }}
\ No newline at end of file +{{- end -}}
\ No newline at end of file |