Add docs for chunking in Antlers
jasonvarga opened this issue · comments
Jason Varga commented
Applies to the collection tag but also could be assets fields etc.
Dumping stuff I tested with:
{{? $chunked_count = 0 ?}}
{{ field chunk="3" }}
<div class="border p-4 mb-4">
<b>Chunk {{ count }}/{{ total_chunks }}/{{ total_items }}</b>
{{ chunk }}
{{? $chunked_count++ ?}}
<li><a href="{{ url }}" class="text-teal font-medium text-lg mb-4">{{ title }}</a> ({{ chunked_count }}/{{ total_items }})</li>
{{ /chunk }}
</div>
{{ /field }}
Where {{ field }}
is either {{ collection:some_collection }}
or {{ some_query_builder }}
(like an assets fields).
chunked_count
is a way to count items across chunks as count
in a chunk would only go 1-2-3-1-2-3-1-2-3...