Pagination

Pagination can be used directly within content. You can paginate any list, not just a list of pages.

It is important to ensure that pagination is not called twice within the same physical page (i.e., make sure the pagination function is not called in the template of this page, and that it is not called more than once either in the content or in the template).

This feature has been available since version 0.1.8b. In previous versions, pagination only worked in templates.

{# The second parameter is the number of list items per page #}
{# It can be omitted — then the value from the configuration file will be used #}
{{ splitToPages(datasets.examples.movies, 10) }}

{# You can do almost anything with the list #}
{{ page.list_page | to_table(["name_en", "director_en"]) }}

{# The template should include pagination output #}

TitleDirector
Avengers: Infinity War Anthony Russo, Joe Russo
Black Panther Ryan Coogler
Justice League Zack Snyder
Thor: Ragnarok Taika Waititi
Wonder Woman Patty Jenkins
Spider-Man: Homecoming John Watts
Guardians of the Galaxy Vol. 2 James Gunn
Doctor Strange Scott Derrickson
Suicide Squad David Ayer
Captain America: Civil War Anthony Russo, Joe Russo