REACH allows you to add pagination (numbered pages) so the information shown on each page is limited to a digestible, easily-readable amount.
To use pagination for any collection of data within REACH, such as a collection of campaigns or sponsorships, reference the example code below.
{% paginate sponsorships by 12 %}
{{ sponsorships | will_paginate }}
{% for sponsorship in sponsorships %}
<!-- Insert code to render sponsorship -->
{% endfor %}
{% endpaginate %}
First, you set how many items you want to display per page – the example will display 12:
{% paginate sponsorships by 12 %}
{% endpaginate %}
Next, you render the pagination buttons to allow for navigating between the pages:
{{ sponsorships | will_paginate }}
Lastly, you can then iterate over each object and add code to display the objects on the page:
{% for sponsorship in sponsorships %}
<!-- Insert code to render sponsorship -->
{% endfor %}
Note: Pagination buttons can be styled using custom CSS.
For additional assistance with this, please contact our Support team.
Let’s Get Social