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
Hi ! Thanks for sharing this !
I tried to implement it in a new 11ty test project, but I struggle to make it work.
Images are passed to my _site folder and I have no error reported, though my images are not showing up in the html rendered page.
Being very new to all this I guess I miss something obvious, would you mind sharing a very simple starter project so I could investigate what I'm doing wrong ?