Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pagination support #140

Merged
merged 31 commits into from
Jul 13, 2023
Merged

Pagination support #140

merged 31 commits into from
Jul 13, 2023

Conversation

jesseleite
Copy link
Member

@jesseleite jesseleite commented Jul 11, 2023

Previously, we linked people to this gist, which was self-described as a temporary workaround:

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.

Closes #10
Closes #63

@jesseleite jesseleite force-pushed the pagination branch 2 times, most recently from cb4286a to 5d061cd Compare July 13, 2023 01:01
@jesseleite jesseleite marked this pull request as ready for review July 13, 2023 02:01
@jasonvarga jasonvarga merged commit 898c602 into master Jul 13, 2023
26 checks passed
@jasonvarga jasonvarga deleted the pagination branch July 13, 2023 17:45
@mbootsman
Copy link

Great! It works perfectly. Thanks a lot!!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

First page of pagination doesn't generate properly Pagination is not supported
3 participants