how to aceed json datas or collections from javascript with eleventy ? #3287
Replies: 2 comments
-
As far as I know this is not possible. 11ty will build the site and output only static files (not including the |
Beta Was this translation helpful? Give feedback.
-
Thank you very much for your answer ! |
Beta Was this translation helpful? Give feedback.
-
Hi,
I'm a very beginner in eleventy.
I'm sorry also for my english.
In a eleventy project, I have a js file called gallery.js in src/js,
In this file i 've got a listener that listen the click on a dropdown.
If an item (a photo category) has been selected, i'm generating an html part specific (photos list corresponding to the selected category in the dropdown menu) that i insert in a div.
If all the datas are in my javascript, it is working.
But i would like to test two other processes.
If the datas are present in src/_data/photos.json I don't know how to acceed to these datas from my javascript file.
Second process.
I created a collection of portraits photos for exemple in .eleventy.js named portraits.
If i call collections.portraits from html, it is working and i can see my portraits photos with a loop.
But
from javascript, i don't know how to acceed to collections.portraits created in .eleventy.js.
can you help me ?
Gaëlle
Beta Was this translation helpful? Give feedback.
All reactions