hugo-theme-learn
hugo-theme-learn copied to clipboard
Navigation arrows on (or below) a hidden page are linking to the wrong pages
Within a hidden page the left and right navigation arrows link to the wrong pages. It seems that a hidden page gets hoisted inside the subfolder (ignoring the weight parameter) and then links to the first not-hidden page.
Moreover, if there is a hidden parent page (_index.md) and the subpages are not hidden, then the navigation buttons of this subpages are not working correctly anymore. They link to the next or prev chapter page instead of the next not-hidden page (which in my case was also below the hidden parent page).
We are also having a lot of problems with the prev-next navigation, but I cannot really identify a reproducible behaviour. For example, we have the following structure right now:
getting-started/
initial-setup/
_index.md
lorem.md
ipsum.md
_index.md
dolor.md
sit.md
framework/
_index.md
The main menu displays this structure accordingly. However, the "next link"-chain goes as follows:
/getting-started//getting-started/initial-setup//getting-started/initial-setup/lorem//getting-started/initial-setup/ipsum//framework/
It skips the rest of /getting-started/ completely (i.e. /getting-started/dolor/, /getting-started/sit/). And if I go to /getting-started/dolor/ or /getting-started/sit/, the next link points to /getting-started/initial-setup/.
I also get different behaviours in different parts of our tree.
I have experienced the same issues of skipped sections during navigation.
I made a small change in layouts/partials/footer.html and it solved the navigation issues for my projects (see https://github.com/bonartm/hugo-theme-learn/commit/2583aaab832e7ef36bb9e625845f34c4c5b44220).
But I know too little of Hugo's internals so I cannot fully explain why this works and if it works in all cases with no side effects.
@bonartm 👍 yeah thx, this seems to fix the issue for us as well :)
Is seems like this is fixed with the latest theme update and Hugo 0.67.0.
I tested it: unfortunately it didn't fix it in my case with a hidden (hidden = true) parent pages. My structure is as follows:
folder1/_index.md <- not hidden parent
page1.md
page2.md
folder2/_index.md <- hidden parent
page_1.md <- not hidden
page_2.md <- not hidden
If I navigate to the URL of folder2/page_1/ then I would expect the next button to link to page_2, but instead it goes to /folder1/
@iaktern can you test whether #346 would fix it for you?
hey, sorry for the late reply. Nope, does not change anything :(
I removed this condition to make it work: https://github.com/matcornic/hugo-theme-learn/blob/master/layouts/partials/footer.html#L16