{{ $parentMenu := ($.Scratch.Get "ParentMenu") }}
{{if $parentMenu}}
{{ $curentURL := .RelPermalink }}
{{ range $parentMenu }}
{{ if ne .URL $curentURL}}
{{ if ne .Identifier ""}}
{{ $.Scratch.Set "TmpMenu" . }}
{{if eq ($.Scratch.Get "NextOK") "OK"}}
{{if not ($.Scratch.Get "NextMenu")}}
{{ $.Scratch.Set "NextMenu" . }}
{{end}}
{{end}}
{{ end }}
{{ else }}
{{ $.Scratch.Set "PrevMenu" ($.Scratch.Get "TmpMenu") }}
{{ $.Scratch.Set "NextOK" "OK" }}
{{ end }}
{{ end }}
{{with ($.Scratch.Get "PrevMenu")}}
{{end}}
{{with ($.Scratch.Get "NextMenu")}}
{{end}}
{{ end }}