Learn

Tag Pair Helper Variables

All tag pairs loops will create a couple of helper variables for you to use to better control how your output displays.

play Watch our screencast on
Variable Tag Pairs

{{ first }}

Will be true during the first iteration of your tag-pair loop, and false all other times.

{{ last }}

Will be true during the last iteration of your tag-pair loop, and false all other times.

{{ index }}

The tag-pair loop’s current iteration, starting with 1.

{{ zero_index }}

The tag-pair loop’s current iteration, starting with 0.

{{ total_results }}

The total number of times the tag-pair will loop.

{{ key }}

When looping through named lists, this will be the current iteration’s key. When looping through simple lists, this will have the same value as {{ zero_index }}.

{{ name }} & {{ value }}

When looping through a simple list, these will be set to the current iteration’s value.

This article was last updated on March 30th, 2016. Find an error? Please let us know!