Open mw75 opened 9 months ago
In general, you're absolutely correct in two ways.
First: 11ty plugins can do the same thing you can do in configuration(*).
Second: the _data
directory does not work this way in 11ty, since it's meant for global data that is available in all templates.
BUT: I think you can solve all this "just" by doing a clever trick with computed data! You can use js computed data to use the path of the input template to load a corresponding data file from a directory you decide (I would not place the data in the _data directory!). If I find the time and this is not already hint enough, I can try building a PoC for you.
I think I already got the idea. But computed data runs to late for setting tags for example. Besides the fact, that it is meant to generate only one value.
For sure you can create a data structure on data.overlay for example, but that would not play nicely with all the existing stuff. Did I miss something?
Thanks and regards, Mario
What does eleventy-overlay-plugin
do? I don’t fully understand the use case yet
I would like to keep content separate from metadata.
I thought that could be achieved by putting corresponding data files in the same directory structure under _data as the template is.
For example consider a template located at posts/subdir/my-first-blog-post.md i would like to place metadata in: _data/posts/subdir/my-first-blog-post.11tydata.js _data/posts/subdir/my-first-blog-post.11tydata.json _data/posts/subdir/my-first-blog-post.json _data/posts/subdir/subdir.11tydata.js _data/posts/subdir/subdir.11tydata.json _data/posts/subdir/subdir.json _data/posts/posts.11tydata.js _data/posts/posts.11tydata.json _data/posts/posts.json
I tried to understand the plugin concept to develop a eleventy-overlay-plugin, but it seams a plugin has no more capabilities than configuration. If i misunderstood the concept please point me to the right documentation.
Regards, Mario