Skip to content

collections api - add collections dynamically #2177

Answered by pdehaan
opheliagame asked this question in Q&A
Discussion options

You must be logged in to vote

I've never gotten nested .addCollection() calls to work.
The way I've done it in the past is by looping over an array of items in my .eleventy.js config file and just calling .addCollection() within the loop. So not sure if you can get around the nested .addCollection() by require()ing https://stackblitz.com/edit/11ty-dteq28?file=_data%2F_github.js and then looping over the .tags property directly to add your dynamic collections.

Replies: 2 comments 7 replies

Comment options

You must be logged in to vote
6 replies
@cfjedimaster
Comment options

@pdehaan
Comment options

pdehaan Jan 18, 2022
Collaborator

@opheliagame
Comment options

@cfjedimaster
Comment options

@opheliagame
Comment options

Answer selected by opheliagame
Comment options

You must be logged in to vote
1 reply
@cfjedimaster
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants