Reversing .Resources order

Hi all!

I’m using Hugo to show photos from a folder.
I’m using this, and that works:

{{ range .Resources }}
	{{ $image := .Resize "1200x q100" }}
		<img loading="lazy" width="{{ .Width }}" height="{{ .Height }}" src="{{$image.RelPermalink}}" alt="">
{{ end }}

I date my photos, so if I take a new photo it gets the name: 2024-03-02.jpg
The new photo goes to the bottom in the album that Hugo generates.

Is there a way to reverse the range .Resources order?
So when I add a new photo it goes to the top of the page?

Thanks for your time!

{{ range sort (.Resources.ByType "image") "Name" "desc" }}
1 Like

Thank you very much! :star_struck:

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.