From 415d3a4c60ce3171bb938ff3af3edfa3a3eb26a1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=B6ren=20Weber?= Date: Sun, 15 Sep 2024 00:02:38 +0200 Subject: [PATCH] arrownav: fix for hidden pages #685 two consecutive hidden siblings resulted in wrong next page --- layouts/partials/_relearn/pageNext.gotmpl | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/layouts/partials/_relearn/pageNext.gotmpl b/layouts/partials/_relearn/pageNext.gotmpl index 4d5c6a08ea..05df71f41b 100644 --- a/layouts/partials/_relearn/pageNext.gotmpl +++ b/layouts/partials/_relearn/pageNext.gotmpl @@ -52,13 +52,24 @@ {{- $parent := . }} {{- $pages := partialCached "_relearn/pages.gotmpl" (dict "page" $parent) $parent.Path }} {{- $nextVisible := partial "inline/next_sibling" (dict "siblings" $pages "currentNode" $currentNode) }} - {{- if $nextVisible }} + {{- range $pages }} + {{- if not $nextVisible }} + {{- break }} + {{- end }} {{- $nextSibling = partial "inline/leftmost_descendant" $nextVisible }} + {{- if $nextSibling }} + {{- break }} + {{- else }} + {{- $nextVisible = partial "inline/next_sibling" (dict "siblings" $pages "currentNode" $nextVisible) }} + {{- end }} + {{- end }} + {{- if not $nextSibling }} + {{- if $nextVisible }} + {{- $nextSibling = partial "inline/leftmost_descendant" $nextVisible }} + {{- end }} {{- if not $nextSibling }} {{- $nextSibling = partial "inline/next_sibling_or_ancestor" $parent }} {{- end }} - {{- else }} - {{- $nextSibling = partial "inline/next_sibling_or_ancestor" $parent }} {{- end }} {{- end }} {{- return $nextSibling }}