Back to topic list

Helper – Grouped each

@!helper @!block helper @!templates

grouped_each helper provides way to split long array into smaller arrays of specified length.


{{#grouped_each :size_of_chunks :context}}

Use case

grouped_each comes handy when you have a list of, say, 30 items and you want to display them 3 at a time. grouped_each will split the list of 30 items into 10 lists of 3 items and provides each list of 3 items as {{this}}.

{{#grouped_each 3 global.documentation_list}}
    {{#each this}}
        <div class="col-md-4">
        <div class="wedge"></div>

Shout out

Thanks @Timothy Robertson of for providing the idea and base implementation.

Back to topic list

Shout out to pexels and freepik