collections api - add collections dynamically #2177
-
I have a list of tags and I want to create a collection for each of those dynamically, but it does not seem to be working with what I am doing currently. Here is a stackblitz example, with line 63-84 demonstrating the issue I am having. Is there any way to do this, or am I doing something wrong? |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 7 replies
-
I've never gotten nested |
Beta Was this translation helpful? Give feedback.
-
What if - in the Then after that call, you loop over the list and add the collections then? |
Beta Was this translation helpful? Give feedback.
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()
byrequire()
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.