We will likely introduce better native support for pagination at some point, but for now, this is an okay workaround that only requires a little code.
This PR adds intelligent pagination support by detecting where paginators are used in core (ie. the {{ collection }} tag with the paginate parameter), generating /articles/page/2 style urls for each page where necessary.
No extra setup or user config is required, unless the user wishes to customize the output url, which they can do like so...
Configuring 'pagination_route' => '{url}/{page_name}/{page_number}' would result in /articles/page/2 (default)
Configuring 'pagination_route' => '{url}/{page_name}-{page_number}' would result in /articles/page-2
Configuring 'pagination_route' => '{url}/{page_name}{page_number}' would result in /articles/page2
Configuring 'pagination_route' => '{url}/p/{page_number}' would result in /articles/p/2
Configuring 'pagination_route' => '{url}/p{page_number}' would result in /articles/p2
Configuring 'pagination_route' => '{url}/{page_number}' would result in /articles/2
Configuring 'pagination_route' => '{url}{page_number}' would result in /articles2
This PR also respects multisite collection indexes, as well as collection tag per-page settings, filters, query scopes, pagination links, auto_links, etc.
Previously, we linked people to this gist, which was self-described as a temporary workaround:
This PR adds intelligent pagination support by detecting where paginators are used in core (ie. the
{{ collection }}
tag with thepaginate
parameter), generating/articles/page/2
style urls for each page where necessary.No extra setup or user config is required, unless the user wishes to customize the output url, which they can do like so...
'pagination_route' => '{url}/{page_name}/{page_number}'
would result in/articles/page/2
(default)'pagination_route' => '{url}/{page_name}-{page_number}'
would result in/articles/page-2
'pagination_route' => '{url}/{page_name}{page_number}'
would result in/articles/page2
'pagination_route' => '{url}/p/{page_number}'
would result in/articles/p/2
'pagination_route' => '{url}/p{page_number}'
would result in/articles/p2
'pagination_route' => '{url}/{page_number}'
would result in/articles/2
'pagination_route' => '{url}{page_number}'
would result in/articles2
This PR also respects multisite collection indexes, as well as collection tag per-page settings, filters, query scopes, pagination links, auto_links, etc.
Closes #10 Closes #63