website/themes/terminal-plus-minus/layouts/partials/optional/breadcrumbs.html

15 lines
567 B
HTML
Raw Normal View History

2019-09-01 17:51:06 +00:00
<nav class="{{ .class }}">
{{ template "breadcrumbnav" (dict "p1" .context "p2" .context "childClass" .childClass) }}
</nav>
{{- define "breadcrumbnav" -}}
{{- if .p1.Parent -}}
{{ template "breadcrumbnav" (dict "p1" .p1.Parent "p2" .p2 "childClass" .childClass ) }}
{{- else if not .p1.IsHome -}}
{{ template "breadcrumbnav" (dict "p1" .p1.Site.Home "p2" .p2 "childClass" .childClass) }}
{{- end -}}
{{- $isCurrent := eq .p1 .p2 -}}
<a class="{{ .childClass }}{{ if $isCurrent }}--active{{ end }}" href="{{ .p1.Permalink }}">{{ .p1.Title }}</a>
{{- end -}}