Twig Components / Methods / paginate
Note: You are currently reading the documentation for Bolt 5.0. Looking for the documentation for Bolt 5.2 instead?
paginate()
is a Twig function to rearrange (and remove) the empty places after using the
filter(arrow) method:
{% set filteredRecords = [] %}
{% for record in records %}
{% set filteredFields = record|filter(r => r.title == title) %}
{% if filteredRecords|length > 0 %}
{% set filteredRecords = filteredFields|merge([record}) %}
{% endif %}
{% endfor %}
{% set records = filteredRecords %}
And then you can use:
{% set records = paginate(records) %}
Source: Bolt
Edit this page on GitHub
Couldn't find what you were looking for? We are happy to help you in the forum, on Slack or on Github.
Couldn't find what you were looking for? We are happy to help you in the forum, on Slack or on Github.