How to randomize blog posts

I am building a recipe website with over 100 recipes currently in my blog. I am displaying the blog on my homepage as a grid layout of 3x3 and it looks great visually with the images. Currently, the blog posts are displayed in chronological order, from most recently added to last added.

Is there an html code that will allow all 100 blog posts to be displayed in a completely random order every time a user lands on the homepage?

Or is there a way to create a button that the user can click to randomize the layout the of the blog posts?

It is very boring for the user to see the same chronological layout everytime they land on the homepage!




1 Like

You might be able to get help regarding this issue at the blog community forum .

The blog community pointed me here. The feature does not exits so requires a specific code to make it happen. Any help would be grand!

Hi @joegilbey47 ,
Can you take a screenshotof your page so i have a better idea of how it looks

Also do you know a bit of coding?
I think you should make an array with 100 random number.
an loop trough the numbers to compare the number with de item number.
then add it to the repeater.
Its alot of code just to make it work but it should do the trick.

Kind regards,

@volkaertskristof Hi Kristof. I have zero knowledge of coding. I was hoping someone had done this before and has a code to share with me

Sadly enough i probably won’t have the time to make a tutorial about it atm.
I might be able to make it this evening.

kind regards,

In the meantime,
Can you export the collection (.csv file) and send it to me? .
This way i don’t have to make a collection myself.

@volkaertskristof Perhaps an idea (what do you think Kristof?

I’m also very keen to know how I can randomize the order of blog posts - if Wix or @The Dude managed to figure this out - appreciate any guidance!

Has anything changed on this matter? any new way to randomize a list of posts? or at least offer ONE random post?

Yup. You could use listPosts function listPosts - Velo API Reference - , randomize entries through javascript, and then use a repeater to show the details with a link to the blogpost itself.