Using eleventy with mattrbld: including json from .mattrbld in the input to eleventy #3618
-
Hi folks, I am very new to eleventy and web development for that matter, so excuse me if this question demonstrates that I am missing something simple but: I am trying to use eleventy along with mattrbld which is a nice, simple, git-based headless CMS (as I'm sure most people know!). The set up I am aiming for is one where a content creator/editor for the site will have access to the site hosted on github pages, they will be able to use the mattrbld gui to add photos to the mattbld media library. When this happens and changes are pushed, it will trigger a rebuild using eleventy via github actions. Mattrbld has a feature where you can add metadata to images that you load into the media library, and this metadata gets saved automatically as json files, one per image, in the .mattrbld directory. I would like to use these json files as the basis of some eleventy collections for the site. But the way mattrbld is set up, the .mattrbld directory needs to be in the root of the repo (so I can't, for example, include it as a subdirectory of the eleventy input directory). I would like to be able to include the json files that exist in the media subdirectoy of the .mattrbld directory in the inputs to eleventy in spite of this, but I'm not sure how to do that or whether it is possible. Any help would be greatly appreciated, and let me know if I have not explained the issue clearly. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 2 replies
-
Hey Conor, sounds intriguing. I would suggest to use the Alternatively you could try this as a Global Data File. |
Beta Was this translation helpful? Give feedback.
Hey Conor,
sounds intriguing. I would suggest to use the
addCollection
API by reading / importing the JSON file in the root of the directory.Alternatively you could try this as a Global Data File.