I know that the default order of content is
Default: Weight > Date > LinkTitle > FilePath
But I want to do it purely by the publish date, on my index.html
so I think that .ByPublishDate
should be my friend.
But when I use:
{{- range (.Paginate .Site.RegularPages.ByPublishDate.Reverse).Pages -}}
Note: I’m doing it that way to get all my content types onto the front page. The theme is my own cbp2
.
The result seems to be ‘by weight’ and then by publish date. So I think, "aha, I need to order .Pages, so I try:
{{- range (.Paginate .Site.RegularPages).Pages.ByPublishDate.Reverse -}}
And indeed, that is better, except that the last few items on the first pagination page are there by weight rather than publish date.
You can see this on my site https://petersmith.org/ (the first page is a bit long for some, but the last few pages have published dates in 2011, whereas I should still be on the 2022 content.
My repository is at GitHub - psmith1303/petersmith: My (kinda) commonplace book
I expect I’m doing something blindingly obvious, but I can see it.
BTW, in case there was some odd interaction between the paginator and the ranging, I also tried:
{{- range (.Paginate .Site.RegularPages.ByPublishDate.Reverse).Pages.ByPublishDate.Reverse -}}
The result was the same as my second bit of code.