diff --git a/layouts/partials/footer.html b/layouts/partials/footer.html index c07802bcc3..db86a98737 100644 --- a/layouts/partials/footer.html +++ b/layouts/partials/footer.html @@ -5,10 +5,46 @@ + {{ with .Site.Params.menu }} + {{ range $index, $element := . }} + {{ with index $.Site.Params.menu (sub $index 1)}} + {{ $prev := index (last 1 (index $.Site.Sections .)) 0 }} + {{ $.Scratch.SetInMap $element "prev" $prev }} + {{ end }} + {{ with index $.Site.Params.menu (add $index 1)}} + {{ $next := index (first 1 (index $.Site.Sections .)) 0 }} + {{ $.Scratch.SetInMap $element "next" $next }} + {{ end }} + {{ end }} + {{ else }} + {{ range $key, $section := $.Site.Sections }} + {{ with $prevSec := $.Scratch.Get "prevIter"}} + {{ with index $.Site.Sections . }} + {{ $.Scratch.SetInMap $key "prev" (index (last 1 .) 0) }} + {{ $.Scratch.SetInMap $prevSec "next" (index (first 1 $section) 0) }} + {{ end }} + {{ end }} + {{ $.Scratch.Set "prevIter" $key }} + {{ end }} + {{ end }}