11ty with netlify vars not working

Hello, I have a site that is build using 11ty. I wanted to use Netlify to host as well as put some environment variables. However, the variables don’t seem to be functioning as I want on my site. I’ve looked through the 11ty docs and saw you have to place these variables under _site data which I did like the exahttps://www.11ty.dev/docs/data-js/#example-exposing-environment-variables example shows, however, I’m sure if I still have to place an env file in the directory as well. If anyone has worked with 11ty and netlify and provide any help it would be appreciated.

hi there, i moved your post as it isn’t actually build plugin related!

did you see this guide on environment variables already?

Yes, I did happen to see that post however I am still having some difficulty with it since I’m new to environment variables and their usage. The part that I’m confused about it is getting these variables into my project the right way. Since I’m setting the environment vars on the build and deploy I think it’s how I’m implementing it into my repo that is the problem. As I mentioned above what I did was set the variables on the UI than I created a js file inside my eleventy _data file as in the example and it didn’t work within my code.

could you show us a screenshot of your env var settings, and also show us some sample code on how you are trying to get the vars into your project?