{{ if eq .Kind "section" }} {{ end }} {{ 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 }}
{{ partial "script.html" . }}