I have a problem with {% if loop.first %}
and {{ loop.index0 }}
with the following snippet:
{% for block in entry.locationSlideshow %}
{% switch block.type %}
{% case 'upload' %}
{% for image in block.image %}
<button {% if loop.first %}class="is-active" {% endif %}data-slide="{{ loop.index0 }}"><span class="show-for-sr">{{ image.title }}</span></button>
{% endfor %}
{% endswitch %}
{% endfor %}
The problem is that all buttons get the class is-active and 0 instead of 0, 1, 2, 3...
This is working fine outside of a Matrix field. Any ideas what I am doing wrong here?
Regards
Ben