Closed westonganger closed 5 years ago
That is a really cool feature request, have wanted something like this for quite some time, however, its quite easy to achieve that already without the grouping. Here is an example:
{% assign slides = contents.activities.count | divided_by: 4 %}
{% assign offset = 0 %}
{% for slide in (1..slides) %}
<li class="is-active orbit-slide">
<div class="slide-wrap">
{% for activity in contents.activities | limit: 4 | offset: offset %}
{% include activity_card %}
{% endfor %}
</div>
</li>
{% assign offset = offset | plus: 4 %}
{% endfor %}
Honestly that solution looks complicated. I would rather not have to come up with wizardry like that for such a common feature.
One nice thing about my solution is that, like the rails version, it is capable of padding the array with the appropriate number of elements for the last group.
Yes, I think we can all agreed that the solution you suggest is better. I am simply giving you a solution if you need it sooner. Take it as you will.
Just added a documentation update for this method.
Once thats merged this issue can be closed.
Just saw your PR. Great work man! Excited to test it :)
Example: