I’m trying to get a random image from a folder and use that to stick at the top of listing pages. I found a snippet in an old thread on the forum which I understand should work pretty well but it’s not doing what I thought.
The snippet I’m using is:
{{ (readDir "/public/images/covers" | shuffle | first 1) }}
This outputs on the page:
[0xc42042a8f0]
Which I guess is a FileInfo object. So I think, “I should just be able to grab the name from that”, like this:
({{ (readDir "/public/images/covers" | shuffle | first 1) }}).Name
But that gives me an error about the Name property not being available. Has anyone got any guidance on this?
Thanks