Skip to content
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? #12776

Closed
simonm3 opened this issue Aug 16, 2024 · 5 comments
Closed

Next/NextInSection and Prev/PrevInSection are flipped? #12776

simonm3 opened this issue Aug 16, 2024 · 5 comments

Comments

@simonm3
Copy link

simonm3 commented Aug 16, 2024

This was previously reported as issue #9158 and apparently closed as resolved. However it is clearly not resolved.

I have a contents page which sorts things in order of the page weight. I would expect the next page to be the next one in the contents but it isn't it is the previous one; and vice versa.

Even the docs say

The behavior of the PrevInSection and NextInSection methods on a Page object is probably the reverse of what you expect.

Surely the intuitive thing is to behave as people expect rather than putting such a comment in the docs?

@bep
Copy link
Member

bep commented Aug 16, 2024

I have had this issue reported ... 100s of times before, which is why that line is in the documentation. I can add that that the original implementation went in the other direction (the way you want it), but that was reported as a bug, I agreed, and we spent 100 hours on a deprecation cycle to change the meaning. The odds of us doing that again now, with even some more thousands of Hugo sites in the wild is ... close to zero, so I'm closing this issue.

The current behaviour comes from Hugo's default page sort when no weight is set: Date descending (newest first), so next goes correctly to the next when you look at it sorted from newest to oldest, but it goes back in time.

Anyhow, even if we wanted to (I don't), we cannot change this.

You can use https://gohugo.io/methods/page/next/ instead if you want.

@bep bep closed this as completed Aug 16, 2024
@simonm3
Copy link
Author

simonm3 commented Aug 17, 2024 via email

@bep
Copy link
Member

bep commented Aug 17, 2024

@bep
Copy link
Member

bep commented Aug 21, 2024

Copy link

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.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Sep 12, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants