+
+
+ {{ if eq $showBreadcrumbs true -}} + {{ partial "breadcrumbs.html" ( dict "ctx" . "output_type" "list" ) }} + {{- end }} +
+
diff --git a/layouts/partials/breadcrumbs.html b/layouts/partials/breadcrumbs.html new file mode 100644 index 0000000..4ea756f --- /dev/null +++ b/layouts/partials/breadcrumbs.html @@ -0,0 +1,42 @@ +{{- $ctx := .ctx }} +{{- $output_type := .output_type }} +{{- $header := print "breadcrumbs/" $output_type "/header.html" }} +{{- $item := print "breadcrumbs/" $output_type "/item.html" }} +{{- $footer := print "breadcrumbs/" $output_type "/footer.html" }} + +{{- with $ctx }} + {{- $path := split .URL "/" }} + + {{ partial $header }} + + {{- if eq .Kind "taxonomyTerm" }} + + {{ partial $item (dict "caption" .Title "url" "" "level" 1 "image" "" "final" true) }} + + {{- else if eq .Kind "taxonomy" }} + + {{/* Find the taxonomyTerm and render */}} + + {{- $taxonomyTerm := .Site.GetPage "taxonomyTerm" .Data.Plural }} + {{ partial $item (dict "caption" $taxonomyTerm.Title "url" $taxonomyTerm.URL "level" 1 "image" "" "final" false) }} + + {{/* Render the taxonomy item */}} + + {{ partial $item (dict "caption" .Title "url" .URL "level" 2 "image" "" "final" true) }} + + {{- else if or ( eq .Kind "section" ) ( eq .Kind "page" ) }} + + {{/* Display all relevant section elements */}} + + {{- partial "breadcrumbs/recursive.html" (dict "output_type" $output_type "sections" .Site.Home.Sections "level" 1 "path" $path "dir" .URL ) }} + + {{- if eq .Kind "page" }} + + {{- $aux := split .URL "/" }} + {{ partial $item (dict "caption" .Title "url" .URL "level" (sub (len $aux) 2 ) "image" .Params.share_img "final" true ) }} + + {{- end }} + {{- end }} + + {{ partial $footer }} +{{- end }} diff --git a/layouts/partials/breadcrumbs/list/footer.html b/layouts/partials/breadcrumbs/list/footer.html new file mode 100644 index 0000000..0672325 --- /dev/null +++ b/layouts/partials/breadcrumbs/list/footer.html @@ -0,0 +1,2 @@ + + diff --git a/layouts/partials/breadcrumbs/list/header.html b/layouts/partials/breadcrumbs/list/header.html new file mode 100644 index 0000000..241a289 --- /dev/null +++ b/layouts/partials/breadcrumbs/list/header.html @@ -0,0 +1,5 @@ +