Hi all!
I have a seemingly simple problem and I may just be missing something simple, so I’m hoping someone can help.
I have a yaml file that looks like this:
pub.yml
:
2022:
- a line of text
- another line of text
2021:
- old and busted
- stuff from last year
...
2015:
- really old
- older stuff
This is a file in my page bundle that I can access using code like:
{{ with .Resources.GetMatch "pub.yml" }}
{{ $data := . | transform.Unmarshal }}
{{ range $index, $value := $data }}
<h3>{{ $index }}</h3>
{{ range $value }}
<p>{{ . }}</p>
{{ end }}
{{ end }}
{{ end }}
This works as expected wonderfully, except that the output is sorted by the first key, ascending (2015, …, 2021, 2022).
How can I sort by the key descending? (2015, …, 2021, 2022)