Iterating through arrays in InstantSearch hits template

WIthin my data, items may contain a number of ‘grades’ and ‘subjects.’ I want to iterate over the data for each item. How can I do that within InstantSearch’s templating engine?

Using something like this will output the data, but this is obviously not correct as it should only output as many elements as there are in the array:

'<div class="mini ui label resource-type-{{{subjects.0.id}}}" data-position="top left"  data-tooltip="Covers {{{subjects.0.name}}} outcomes">{{subjects.0.name}}</div>' +
'<div class="mini ui label resource-type-{{{subjects.1.id}}}" data-position="top left"  data-tooltip="Covers {{{subjects.1.name}}} outcomes">{{subjects.1.name}}</div>' +
'<div class="mini ui label resource-type-{{{subjects.2.id}}}" data-position="top left"  data-tooltip="Covers {{{subjects.2.name}}} outcomes">{{subjects.2.name}}</div>' +
'<div class="mini ui label resource-type-{{{subjects.3.id}}}" data-position="top left"  data-tooltip="Covers {{{subjects.3.name}}} outcomes">{{subjects.3.name}}</div>' +
'<div class="mini ui label resource-type-{{{subjects.4.id}}}" data-position="top left"  data-tooltip="Covers {{{subjects.4.name}}} outcomes">{{subjects.4.name}}</div>' +
'<div class="mini ui label resource-type-{{{subjects.5.id}}}" data-position="top left"  data-tooltip="Covers {{{subjects.5.name}}} outcomes">{{subjects.5.name}}</div>' +
'<div class="mini ui label resource-type-{{{subjects.6.id}}}" data-position="top left"  data-tooltip="Covers {{{subjects.6.name}}} outcomes">{{subjects.6.name}}</div>';

Is there any possibility to produce some kind of foreach loop?

I really should get better at searching (go figure!)