I have in folder: /static/images/
aaa-aaa-model1.png
aaa-aaa-model3.png
aaa-aaa-model4.png
aaa-aaa-model2.png
and i need this output:
aaa-aaa-model1.png
aaa-aaa-model2.png
aaa-aaa-model3.png
aaa-aaa-model4.png
So as you can see it needs to read .Page.Title (this is in example value: aaa-aaa) and need to order output by numbers that ends at the end of -model string (1…4).
This i need for my gallery slideshow to show images in order by filename numbers that begins with .Page.Title
Here is my try but i got error: ```
: wrong number of args for hasPrefix: want 2 got 3
{{ range (readDir “/static/images/”) }}
{{ if hasPrefix .Name “%s-model” .Page.Title }}
{{ end }}
also can readDir accept to scan only by .Page.Title so that i can remove if syntax and code to run faster?