Skip to content

Pagination support#140

Merged
jasonvarga merged 31 commits into
masterfrom
pagination
Jul 13, 2023
Merged

Pagination support#140
jasonvarga merged 31 commits into
masterfrom
pagination

Conversation

@jesseleite

@jesseleite jesseleite commented Jul 11, 2023

Copy link
Copy Markdown
Contributor

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 requested a review from jasonvarga July 13, 2023 02: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
@jasonvarga jasonvarga deleted the pagination branch July 13, 2023 17:45
@mbootsman

Copy link
Copy Markdown

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