Closed jloh closed 5 years ago
Could you make a custom collection that transforms the data in to a flatter structure at compile time?
I ended up munging the data into a list using a node.js script, sorry this probably isn't the solution anyone who stumbles upon this is hoping for!
Sorry if I should be asking this question elsewhere, but I'm trying to create a data driven website and am wondering whether its possible to paginate on my data if its not in a array.
I basically want to group on a certain key which I can do with my current structure (see below) using the
group
key and thegroupby
utility.My current structure is a big array and I can paginate off it and display it on my index page:
Index:
Pages:
This all works fine, no issues so far! What I'm wondering is whether its possible to structure my data differently but still achieve the above. I'd like to structure it like this (or something like it):
And group on the first set of keys, looping over each array inside it (ie each array under
2XX
) and again, paginating on those. I'm 99% sure this isn't possible but just thought I'd check!Apologies if this doesn't make any sense! I'm loving 11ty so far though!
Edit: Forgot to mention I'm using Nunjucks templates so the specific group by stuff should likely be asked there, I guess I'm just curious about the pagination ability!