Open lambertwiddersinn opened 1 month ago
Hugo by default lists content by their weights and then by date. https://gohugo.io/templates/lists/#sort-content
What do you think about adding orderByWeight
to Recents (and to terms.html for cohesion)?
This would allow for configuring order scheme similar to list template in other parts
@lambertwiddersinn @nunocoracao
I think it's a good idea to add that to recents and terms for more cohesion. For lists I can choose now the sorting logic by date or weight thanks to your work. It works really well.
I would rather define a default that makes sense instead of adding more configs. It's already pretty bloated.
Describe the bug By adding a weight to articles, the recent articles section on home gets sorted by weight instead of date.
Expected behavior It should be ordered by date because it's called recent.
Solution
Add
ByDate.Reverse
in the partial recent-articles for cardview-fullwidth.html, cardview.html and list.html.{{ range first $recentArticles (.Paginate (where .Site.RegularPages.ByDate.Reverse "Type" "in" .Site.Params.mainSections)).Pages }}