By default, Hugo sorts pages by weight, then by date, then by link title, then by file path. I’m trying to change this to sort by weight then by title.
Here’s what I’ve tried:
In layouts/_default/list.html:
{{ range .Pages.ByWeight .Pages.ByTitle }}
{{ partial "postCard" . }}
{{ end }}
This doesn’t work as .Pages.ByTitle is considered an argument of .Pages.ByWeight in this case.
Thanks for this @jmooring. This has the unintended consequence of changing the way posts are listed. It appears now that posts from sub-branches are listed on the root branch:
Before:
I would need to see all of your templates to be sure. Please share a link to your project repository.
If I had to make an educated guess, try ranging over .Pages instead of site.RegularPages. The sample code I posted above was a generic example of how to group then range.
Apologies; I intended to include that link with my original post and forgot. However, using .Pages instead of site.RegularPages does the trick! Thanks so much for the help! I’ll accept this as the answer, but wonder if you might point me to the documentation where I can learn about the difference between .Pages and site.RegularPages as well.