Ability to refresh random sort on page refresh

Hi,

The randomiser is awesome for mixing up dynamic content on a blog page. But are we able to have those items randomised on refresh without having to republish?

You don’t have to republish to have them randomized again. The items gets randomized every 12 hours.
:smile:

1 Like

1 Like

Is there a way to have them randomize on refresh though, or with the press of a button or link? It would be a great way to be able to create simple Magic 8 ball type interactions where a user can refresh and get a different thing every time.

Hey @tubes for randomizing on refresh you’d need a little custom code, this post may be helpful for you :wink: [CMS] Random sorting - #12 by Waldo - Product feedback - Forum | Webflow

1 Like

Thanks Waldo! Much appreciated.

1 Like

@Waldo awesome trick for randomizing in the CMS. I’m wondering, is there a way to randomize hero images on refresh for a static website? An example is prometheusreg.com

Every time you visit the site and/or refresh…there is a new hero image. Would love to do this

1 Like

@Syndicate15 my pleasure to help. The same trick above should work if you have the hero images as child elements of some parent element :smile: maybe try searching the Web for “random sort on page refresh Javascript” (pretty sure that’s what I’d searched for before) :smile: and try applying that logic :smile:

1 Like

Absolutely, will do! Just the word “code” strikes fear into the core of my being haha. But like you said, apply the logic :+1:t3:. I’ll let everyone know if I manage to get it up and going, thanks again @Waldo

Hello!

I am trying to create a page for a friend where a single funny tweet or thought he has appears on the page. Below this line of text is a button that says “Another!”. What I would like to happen is that you can click on this button and a new line of text appears–sort of like a magic 8-ball. I would also like the text on the button to change words too.


What I did was make two collections: one for the central text and one for the button text. I then made a dynamic list with a random sorting order and limiting it to 1 item from the collection. I added a script to the button so that when pressed it refreshes the page. The problem is that I can’t seem to actually randomize it. it will only randomize if i publish the site again.

I looked on the forums, and there was an article about how you can randomize the sort order, and (using a custom script) trigger the randomizing upon a refresh. The problem with this, though, is that it only works if you display all the items in your collection. I only want to display a single item from my collection, but which one that is changes on each refresh.
Can you all think of something I could do to achieve this?
(when you click on my public share link, the page i am trying to work on is called thoughts.)

Thank you!

Here is my public share link: LINK
(how to access public share link)

Hi @zach, the random sort refreshes only at publish, because publishing updates the CDN cache.

The sort from CDN cache is updated every 12 hours otherwise or if using some custom script solution (at the moment).

I would look into creating a new post about how to create this using custom code until the desired behavior is updated to the feature. It certainly sounds like this is a good thing to make possible :slight_smile:

Stay tuned for more updates in this area.

thank you! I thought i was writing this in the design board. Apologies!