From 06a78ff287d3fc51cb8f5d04dfdc751379fa10ff Mon Sep 17 00:00:00 2001 From: mms Date: Wed, 24 Apr 2024 20:00:47 +0200 Subject: chore: add bottom nav to BSD --- layouts/partials/single/bottom_nav.html | 82 +++++++++++++++++++++++++++++++++ 1 file changed, 82 insertions(+) create mode 100644 layouts/partials/single/bottom_nav.html (limited to 'layouts/partials/single/bottom_nav.html') diff --git a/layouts/partials/single/bottom_nav.html b/layouts/partials/single/bottom_nav.html new file mode 100644 index 0000000..88dbf9c --- /dev/null +++ b/layouts/partials/single/bottom_nav.html @@ -0,0 +1,82 @@ +
+{{- $page := .page }} +{{- $menuID := cast.ToString .menuID }} + +{{- if $menuID }} + {{- with index site.Menus $menuID }} + {{- partial "inline/single/walk.html" (dict "page" $page "menuEntries" . ) }} + {{- end }} +{{- end }} + +{{- partial "inline/single/up.html" (dict "page" $page ) }} + +{{- define "partials/inline/single/walk.html" }} + {{- $page := .page }} + {{- $found := false }} + + + {{- range .menuEntries }} + {{- if $page.IsMenuCurrent .Menu . }} + {{- $found = . }} + {{- end }} + {{- end }} + +{{ if eq $found false}} + + {{- range .menuEntries }} + {{- with .Children }} + {{- partial "inline/single/walk.html" (dict "page" $page "menuEntries" . ) }} + {{- end }} + {{- end }} +{{- else }} + + +{{ $found_weight := $found.Weight }} +{{ $found_url := $found.URL }} + + +{{- range (where + (where + (where + (where + .menuEntries + "Params.placeholder" "ne" true) + "Params.nonpage" "ne" true) + "URL" "ne" $found_url) +"Weight" "le" $found_weight) | last 1 }} + + Prev: {{ .Name }}, +{{- end }} + + +{{- range (where + (where + (where + (where + .menuEntries + "Params.placeholder" "ne" true) + "Params.nonpage" "ne" true) + "URL" "ne" $found_url) +"Weight" "gt" $found_weight) | first 1 }} + Next: {{ .Name }}, +{{- end }} + +{{- end }} + +{{- end }} + +{{- define "partials/inline/single/up.html" }} + {{- $page := .page }} + {{- $nearest := true }} + Up: + {{- range $page.Ancestors }} + {{- if .LinkTitle}} + {{- if $nearest}} + {{ .LinkTitle }} + {{- $nearest = false }} + {{- else}} + [{{ .LinkTitle }}] + {{- end }} + {{- end }} + {{- end }} +{{- end }} -- cgit v1.2.3