Assigning class to random posts in loop

Hey Ghost geniuses :slight_smile:

Trying to figure out how to pass an array of randomly generated numbers to articles within a posts loop. In other words, something like this:

{{#get "posts"}}
   {{#foreach}}
      <article class="gh-card {{#has index="0,1,4,6"}} large{{/has}}>        
    {{/foreach}}
{{/get}}

…but instead of 0,1,4,6 I’d use an array of randomly generated numbers within the number of posts being paginated in tag.hbs.

Any bright ideas or pointers?

To generate a random collection of posts, you’ll want to reach for client-side JavaScript, since this won’t be possible via templating.

Let me know if you want some more ideas about how to do this! :smile: