Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.Sign up
Custom collection - can't return an object #277
I'm trying to use a custom collection to return an object.
However, I get the following error:
The docs state "addCollection callbacks can now return any arbitrary object type and it’ll be available as data in the template. Arrays, strings, objects—have fun with it." - this makes me think it should be fine to return an object.
I've tested with a fresh install of the base blog and adding a custom collection that returns an empty object, and an object with a key value pair.
For my personal site I've gotten around it by returning the object wrapped in an array. But this means when I access the data or paginate on it, I have to call
The other thing I got to work was returning a Set - but while Eleventy works with it and does pagination on it, I'm struggling to get Nunjucks to iterate over the set.