chrissy-dev / eleventy-web-starter

Eleventy Web Starter is a lightweight Eleventy boilerplate utilising, ESBuild Tailwind and PostCSS.
https://eleventywebstarter.netlify.app
MIT License
314 stars 31 forks source link

Missing site data path in Eleventy config #17

Closed camflint closed 3 years ago

camflint commented 3 years ago

Hi there, thanks for the amazing starter template! I had to change one thing to get it working:

// .eleventy.js
        dir: {
            input: "src/",
            output: "dist",
            includes: "_includes",
-            layouts: "_layouts"
+            layouts: "_layouts",
+            data: "_data"
        },

Without that line, the src/_data/site.js global data is not provided to the Nunjuck template environment. For example site.title, site.description, site.env cannot be accessed.

chrissy-dev commented 3 years ago

Hey @camflint,

Thanks for taking the time to flag this.

The data directory in this project is the default Eleventy data directory, that's why it's not defined, it should fallback. The default is _data and the folder is relative to the input directory, for example: src/_data, which is where the folder lives. I can run the project without it being defined, what OS are you running 🤔?

Cheers!

chrissy-dev commented 3 years ago

I'm closing this for now @camflint, please feel free to reply and reopen if the issue persists 😃