Configure Hugo | Hugo says that the default page order for Page.Next/Page.Prev/Page.NextInSection/Page.PrevInSection sorts by weight, then date, then link title, then path. However, it appears that all these orderings share the same “direction” (asc or desc). It defaults to desc, but you can change it to asc for Page.Next/Page.Prev and Page.NextInSection/Page.PrevInSection independently of the other:
page:
nextPrevSortOrder: "desc"
nextPrevInSectionSortOrder: "desc"
That’s fine, however, I would like control over the direction of each field sorting. Since weights are sorted descending by default, if you weight all pages, and add pages over time to the end of the page list, then you have to make all weights negative, and each new page has a more and more negative weight value, e.g. -1, -2, -3. This seems unintuitive. I would expect the weights to progress as 1, 2, 3.
I can write my own ordering logic in my own theme that accomplishes this (and I have), of course, but that forces my own preference on all my theme’s users. It would be better to allow users to configure their own orders in Hugo outside of modules.
I propose adding these options for configuring the sorting of Page.Next/Page.Prev/Page.NextInSection/Page.PrevInSection:
page:
nextPrevSortFields: ["Weight", "Date", "LinkTitle", "Path"] # Default value
nextPrevSortDirections: {"Weight": "desc", "Date": "desc", "LinkTitle": "desc", "Path": "desc"} # Default value. Invalid to set along with nextPrevSortOrder; nextPrevSortOrder basically sets these all to "asc" or "desc"
nextPrevInSectionSortFields: ["Weight", "Date", "LinkTitle", "Path"] # Default value
nextPrevInSectionSortDirections: {"Weight": "desc", "Date": "desc", "LinkTitle": "desc", "Path": "desc"} # Default value. Invalid to set along with nextPrevInSectionSortOrder; nextPrevInSectionSortOrder basically sets these all to "asc" or "desc"
I propose adding these options for configuring the sorting of Page.Pages:
page:
pagesSortFields: ["Weight", "Date", "LinkTitle", "Path"] # Default value
pagesSortDirections: {"Weight": "desc", "Date": "desc", "LinkTitle": "desc", "Path": "desc"} # Default value