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
Batman v Superman: Dawn of Justice Zack Snyder
Ant-Man Peyton Reed
Avengers: Age of Ultron Joss Whedon
Guardians of the Galaxy James Gunn
Captain America: The Winter Soldier Anthony Russo, Joe Russo
Thor: The Dark World Alan Taylor
Man of Steel Zack Snyder
Iron Man Three Shane Black
The Dark Knight Rises Christopher Nolan
The Avengers Joss Whedon