I want to insert a div with a class of row every 3 posts pulled from {{#each posts}} for my grid system but I’m failing to figure out how to do it.
Currently I’m using the following on my index page:
{{#if featuredPosts}}
{{#each featuredPosts}}
{{#checkIf @index '==' 0}}
{{/checkIf}}
{{#checkIf @index '==' 3}}
{{/checkIf}}
{{#checkIf @index '==' 2}}
{{/checkIf}}
{{#checkIf @index '==' 5}}
{{/checkIf}}
{{/each}}
{{/if}}
Of course if the count doesn’t match up the will not be created which will create broken html. So I need to be able to get the featured posts count and do math inside of the checkIf helper for example: {{#checkIf {{math @index ‘/’ 3}} ‘==’ 1}}. I tried this and I get an error.