What I want: Create a gallery/collection of images based on the contents of a folder. Automatically.
Surprisingly there is almost no guide out there that explains how to do this. And the few that do clutter the .eleventy.js file.
This uses data-js as a template-specific data file. Simply said: gallery.11tydata.js needs to have the same name and be in the same folder as the corresponding template gallery.md (actually Nunjucks .njk).
Possible improvements:
- Process the filename, slugify it and add it as gallery title.
- Also add the image creation date.
Based on
Thanks for your answer :)
The html markup simply didn't show, just like if the gallery.11tydata.js wasn't processed.
I'll give it some more time though, since I now understand a bit better 11ty's structure