Random Hero Image Element

I’m trying to display a random image from a list on my homepage each time the page is refreshed, but I’m having trouble getting it to work. I thought this would be straightforward, but it’s turning out to be more complicated than I expected.

Here’s what I’ve done so far:

• I set up a data type called “Index | Random” with a field called “Images”, which is a list containing all the images I want to use.

• I connected a repeating group to this data type.

However, when I try to add the expression to display a random image, I encounter this issue:

If I select “More,” it prompts me to select individual items in the list:

When I select one of the images, it displays that image, but it’s always the same one and doesn’t change on page refresh.

What am I missing here? How can I get it to display a random image from the list each time the page loads?

You need to create 5 entries of the data type called " Index | Random", each entry should have 1 field called “image”. So in your database you should see 5 records (or more, whatever you want). Then your set up will work!

Right now you have 1 entry with 5 fields, and there IS a way to make that work but it would be more complex than the above.

Thank you that was it! I appreaciate the help!!!

Glad I could help! Happy bubbling