I have a page on my website where I show some photos I have taken. You can see it at tomgamon.com/photos.
The file structure for the page is like so.
content
└── photos
├── 2021-05-01.jpg
├── 2021-10-01.jpg
├── 2021-12-01.jpg
└── _index.md
The photos page has a layout which includes this following snippet which iterates over the photos in the folder and renders them.
{{ with .Resources.ByType "image" }}
{{ range . }}
{{ $imageMed := .Resize "600x webp photo q100" }}
{{ $imageSml := .Resize "350x webp photo q100" }}
<img class="photo" srcset="{{ $imageMed.RelPermalink }} 600w,{{ $imageSml.RelPermalink }} 350w" src="{{ $imageMed.RelPermalink }}" loading="lazy" sizes="(min-width: 800px) 600px, 100vw">
{{ end }}
{{ end }}
If you visit the link above, you will see it all works fine. However, the files currently output in ascending order, like so:
- 2021-05-01.jpg
- 2021-10-01.jpg
- 2021-12-01.jpg
Ideally I would like them to output in descending order like so:
- 2021-12-01.jpg
- 2021-10-01.jpg
- 2021-05-01.jpg
Is there any way I can achieve this with Hugo without resorting to renaming all my files?