How to sort one page of taxonomies (maybe) from old to new and one from new to old?


#1

I’m very new to hugo, and I have a question.

I have a website with a feed (homepage) that shows all the posts from newest to oldest. I have two different types of post: a training post and a weekly post. I also want to make two seperate pages, one that sorts all the training posts from old to new and one that sorts all the weekly posts from new to old. How would I do this? Tags, Categories? I’m using the “hugo casper two” theme. This is the site: DecodeZone


#2

Did you read this page: https://gohugo.io/functions/sort/#readout?

Should help you.


#3

If your content is organized like this:

  Post 
    ├── Training
    └── Weekly

You don’t need to use taxonomies. You can create your lists in the _default/list.html with something like:

{{ if eq .Section "training" }}
<--- range posts here --->
{{ end }}
{{ if eq .Section "weekly" }}
<--- range posts here --->
{{ end }}

To order your content pages within the above conditions see: https://gohugo.io/templates/lists#order-content


#6

I figured it out now, thank you very much!