diff options
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 |