I don’t use any <time> format on layouts. So, it works for all sections ordered by title alphabetical. How to make it works ordered by newest post without adding <time> format on layouts?
The only thing that comes to my mind would be to have a look at:
This function returns Go’s os.FileInfo and within that interface there is ModTime() time.Time // modification time
Don’t know if it is possible to order a list by file modification time in Hugo.
You may try and see for yourself.
Of course you would also need to refactor your list templates and use:
However the above approach seems like a super complicated course of action.
I would only consider the above if I had thousands of content files and I didn’t want to manually enter a date parameter but even then the usual methods of ordering lists (e.g. By Last Modified Date) are simpler than Local File Templates by far…
Thanks for support. I tried lastmod method before. But the problem is, everytime I make an edit to old post, that old post will bumped to the first page.
Yes, I tried it. But the result is on pagination (prev next button) go from one section to another section, due to same published date. Maybe I have to try .GroupByPublishDate.Reverse to make it appear by newest post without crossing section. Or create different list layout for each section.