2

Is it possible to limit and offset the output of a Matrix field by 50%? I wanted to split the data across two columns.

2

This is what I have used, some math and the slice filter.

{% set midIndex = ((entry.myMatrixField|length) / 2)|round - 1 %}

{% set blocksA = entry.myMatrixField|slice(0, midIndex) %}
{% set blocksB = entry.myMatrixField|slice(midIndex, null) %}
1

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.