This works as I had intended (sorts from old to new) when I view my site using the Hugo web server. However, when I run the Hugo command to general the files for publication, the sorting doesn’t work (it sorts from new to old).
Can someone help me understand why the Hugo rendered file doesn’t sort in the same way as when I render the site using the Hugo server?
hugo v0.111.3+extended linux/amd64 BuildDate=unknown
git version 2.25.1
Without seeing more of your repo or a reproducible test repository (i.e. you have not given enough context to do more than guess at this point) I would have to guess you are calling .Paginate somewhere else for the same page or are adding the pagination template to the page more than once.
Thanks for responding to my question. But why is the result different between the Hugo built in server vs exporting the files using Hugo? When the Hugo server is running, the site is displaying the order that I would like it to however when I export the files using the Hugo command, the generated index.html file has the reverse order.
The answer does not (at least as far as I can tell) lie in the code you posted in code blocks in your question, but elsewhere in your repo (likely in combination with the Stacks theme). Therefore, we need to see the repo, or an example repo that consistently reproduces the error, to help.