Get random post

how do i do this for tags? I want to show 10 random tags at the bottom of every post.

1 Like

+1 I have a similar request (need). If this is possible in some way it’d be wonderful.

1 Like

+1 a random helper would be really nice :crossed_fingers:

Why still there is no random helper in Ghost CMS?

There is not and will never be a random handlebars helper in Ghost for the reason explained by Kevin (And me several times on the forum)

Handlebars is executed on the server side. It is expected that the resulting generated HTML be heavily cached.

So a random helper would not work the way you expect in most cases.

If you want to randomise data, this needs to be done client side using the Content API.

So that new guests who discover my blog/site can not read my old articles. I think random feature increase staying and wasting time more in website. Unfortunately currently this is not possible :frowning_face: Thank you very much for your reply.

Is there an example for using the Content API? I attempted and couldn’t figure out a way to truly do anything random with NQL. I got it working but querying ALL posts and then plucking a random one with some JS client side, but the overhead waiting on all posts to then pick a random one wasn’t preferred.

I optimized it using that “field” property to only include the bare minimum, like the title and enough details to build the link to the random post, but still wasn’t preferred. Not sure if I misunderstood an easier way on that.

3 Likes