Randomising collection post with each refresh

Hi team!

Ok I have a super specific request! I am working on a project where I need three collection posts to appear at random on every refresh? Is this possible? I have been trying for the last three days but am very lost!

Thank you so much!

Sophie

Hey Sophie

This would probably require a good amount of custom code. Here is how I would imagine it should work: On load, push Posts inside of array; Sort the array with a randomizer algorithm; Place the posts in the order of the array.

This a quite a mouthful, so I would recommend that you use Webflow’s random sort (updates every 12hr)

I hope this helps a tiny bit

Hi Sophie,
Try adding something like this in your custom code field: Before tag:

<script>$(".collection-list-wrapper-class").append($(".collection-list-class").children().sort(function () {return Math.random() - 0.5; }));</script>

Change classes to your needs!

Cheers,
Pat