Is there a way to sort page resources with filename?

I need to range over some page resources and sort them by filename, something like this:

{{ with (.Resources.ByType “page”).Match “content/mypages.md” }}

{{range sort . .File.BaseFileName }}

    {{.}}

{{end}}

{{end}}

I have tried many things but nothing works.

Thank you!

Hi there,
Unfortunately we cannot know what you have already tried but this above is a misuse of sort.

Sort takes as second parameter a string holding the property to sort by. So try:

{{ range sort . “Name” }}
[...]
{{ end }}

And see what happens.

2 Likes

Indeed it works! The thing is that i thought that Title and Name were the same thing but i was wrong.

Thank you very much!