[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
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

add support for multi pagination #1559

Draft
wants to merge 5 commits into
base: main
Choose a base branch
from

Conversation

gryphonmyers
Copy link
@gryphonmyers gryphonmyers commented Dec 19, 2020

A common use case is to iterate over more than one data set, and generate routes for all combinations between those sets. For example, if I am rendering a set of articles in a set of locales, it might look something like:

locales: ['en-US', 'de-DE', 'zh-TW']
articles: ['article-1', 'article-2', 'article-3']

/en-US
  /article-1
  /article-2
  /article-3
/zh-TW
  /article-1
  /article-2
  /article-3
/de-DE
  /article-1
  /article-2
  /article-3

At present, 11ty only indirectly supports this pattern. The burden of combining the data falls to the user, as described in #1412. This PR seeks to address that issue by adding full support for multiple pagination.

The API involves supplying pagination as an array of pagination objects. This allows us to cleanly support all existing pagination features with full backward compatibility. If a pagination array was supplied, the pagination in the data object will also be an array, with each pagination object in the array providing context specific to the corresponding data set. This allows for an extremely flexible user experience. Given the example above, I will have pagination context not only for neighboring articles in the same locale, but also neighboring localized versions of the same article.

@cchance27
Copy link
cchance27 commented Oct 25, 2021

Could this be used to take say a data source that gives back categories, and then paginate an array of items based on those categories for instance...

typeData: ["car", "truck"]
vehicleData: [{name: "toyota", type: "car"}, {name: "toyota1", type: "car"}, {name: "toyota", type: "truck"}]

For instance /car/page-2/

Right now I can generate using the 1 per page the first layer of /car/ /truck/ based on the first array's results using the standard pagination of 1, but then breaking down sub-object pagination seems complicated, I take it that's sort of what this is looking to fix?

The issue i saw with the referenced ISSUE, was that it seemed to rely on a 1:1 relation not allowing for generation over 1 size but then multiple per page for a different key

@m4rrc0 m4rrc0 mentioned this pull request Mar 27, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants