I try to write a row in which there are two columns:
<div class="row">
<div class="block_txt"></div>
<div class="block_txt"></div>
</div>
<div class="row">
<div class="block_txt"></div>
<div class="block_txt"></div>
</div>
{# and so on and so on #}
Now maybe there is only one block_txt
div at the end so I try to wrap the row tag in a devisibleby
conditional to only write the row tag every second time, or at the end.
It looks like this:
{% for entry in entriesInYear %}
{% if loop.index is divisibleby(2) or loop.first %}<div class="row">{% endif %}
<div class="block_txt">This gets repeated n times</div>
{% if loop.index is divisibleby(2) or loop.last %}</div>{% endif %}
{% endfor %}
But that doesn't work the way I want. Every third block_txt isn't wrapped in a row. How do I have to math this? Or is there a better way to write the whole piece?