eleventy
eleventy copied to clipboard
Pagination: let data key be a function
So that pagination data key can be determined dynamically, based on a callback function that gets passed all template data. So you can do something like:
---js
{
pagination: {
data: (data) => {
return "collections." + data.foo;
},
...
I just stumbled across https://www.webstoemp.com/blog/basic-custom-taxonomies-with-eleventy/ , which led me to #332 , which I see has a multitude of other issues linked to it.
In case I didn't make it clear before (I don't think I did): this PR solves double pagination! (My other recently-opened PR #1697 also solves it, but I think this one is more elegant). That's exactly why I made this change - to make pagination work on tag pages.
@zachleat your code in https://github.com/11ty/eleventy/issues/332#issuecomment-445236776 is ok as an interim solution, but I think "double pagination" should be made possible in Eleventy, without having to copy-paste so much code (and you're kind of duplicating the chunking that the pagination plugin does internally).
So, this is potentially all we need, to fulfil the enhancement item #461 , which I see has quite a few votes, and is currently pinned.
Please consider getting this in!
@zachleat any chance you could take a look at this? Has been more than 3 months. There has been no other progress in resolving the double pagination problem, as far as I'm aware.
@zachleat please? This PR has been up for a whole year now. I've been running this change in production for that whole time too. Would you mind reviewing it?
Rebased against latest master and resolved conflicts