{% set i = 0 %} {%- for item in items -%} {% set i = i + 1 %} {% if i == 1 %} {% else %} {% endif %} {%- endfor -%}