-
-
Notifications
You must be signed in to change notification settings - Fork 7.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Next/NextInSection and Prev/PrevInSection are flipped? #9158
Comments
We have had this discussion before, use the search function. Ask further questions at https://discourse.gohugo.io/ |
This is neither a question nor a discussion, but a bug report. The search function yielded nothing. The first issue is not the same as my issue. In the scenario I presented, Also note that in my test, I specifically have set the weight for all pages, something which the other issues did not do. So that means this behavior cannot be explained by default sort order. I'm still believing something weird and unintentional is happening here. Also, I know how to work around this and I don't need support. This is besides the point. The point is that Next/Prev do the opposite than what the documentation claims they do. Which means either Hugo has incorrect behavior, or the documentation is incorrect or misleading. |
Hi @Wuzzy2 , I am seeing the same issue, sorting by weight with hugo v0.91.0-D1DC0E9A linux/amd64 BuildDate=2021-12-17T09:50:20Z VendorInfo=gohugoio |
This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
It seems that
Next
/NextInSection
andPrev
/PrevInSection
(page vars) are flipped. I.e. the "next" actually returns the previous page and vice-versa.How to reproduce
Create a number of content pages named
1.md
,2.md
, ... Give them a weight equal to their pre-suffix file name. According to the docs, lower weight has higher precedence, which means it must come first.Then for the content page layout, do this:
Start
hugo server
and point the broser to one of the content page3
.Expected: Next and NextInSection show 4, and Prev and PrevInSection show 2.
Actual result: Next and NextInSection show 2, and Prev and PrevInSection show 4.
I also tested this with a
{{ range .Site.Pages.ByWeight }}
but for this, the pages oddly appear in the expected order (1, 2, 3, 4, ...). It seems only those specal page vars are affected.Compability concerns
If my bug report is correct and not due to my own failure, and you want to fix the bug, I have concerns about compability. If you fix it just by flipping the variables, this might cause breakage of existing sites that depend on this bug. A good solution would be to deprecate those symbols, still support them, but print a warning when they are used. And then introduce symbols that have similar names but use the correct behavior.
What version of Hugo are you using (
hugo version
)?Does this issue reproduce with the latest release?
Yes.
The text was updated successfully, but these errors were encountered: