hugo-theme-learn icon indicating copy to clipboard operation
hugo-theme-learn copied to clipboard

Navigation arrows on (or below) a hidden page are linking to the wrong pages

Open kaigrunert opened this issue 7 years ago • 8 comments

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).

kaigrunert avatar Sep 26 '18 12:09 kaigrunert

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:

  1. /getting-started/
  2. /getting-started/initial-setup/
  3. /getting-started/initial-setup/lorem/
  4. /getting-started/initial-setup/ipsum/
  5. /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.

fritzmg avatar Sep 15 '19 19:09 fritzmg

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 avatar Nov 18 '19 16:11 bonartm

@bonartm 👍 yeah thx, this seems to fix the issue for us as well :)

fritzmg avatar Nov 19 '19 10:11 fritzmg

Is seems like this is fixed with the latest theme update and Hugo 0.67.0.

fritzmg avatar Mar 10 '20 09:03 fritzmg

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/

kaigrunert avatar Mar 11 '20 11:03 kaigrunert

@iaktern can you test whether #346 would fix it for you?

fritzmg avatar Mar 11 '20 11:03 fritzmg

hey, sorry for the late reply. Nope, does not change anything :(

kaigrunert avatar Mar 31 '20 19:03 kaigrunert

I removed this condition to make it work: https://github.com/matcornic/hugo-theme-learn/blob/master/layouts/partials/footer.html#L16

Guite avatar Jan 17 '22 08:01 Guite