Can't get YAML files to be read as global data #2656
-
|
I am trying to set up eleventy to use YAML for global data. I find it much easier to type out than something like json. I followed the instructions in the documentation, but it's not working. My .eleventy.js config file looks like this. I have been trying to set up my site navigation using a YAML data file, which looks like this But it is not working. I tried setting up a debugging filter to output all the global data, so I could see if the YAML data was being compiled and it's not. It doesn't even show up in the global data. I did try writing the data in json and was actually able to get the contents to show up as global data. But I would really like to get it to work as YAML and I don't know why it won't. I don't know what I am missing. Does anyone have any advice to get this working? |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments
-
|
Re: https://www.11ty.dev/docs/data-custom/#usage
Are you using v2 canary branch? Or the stable v1.0.2 branch? |
Beta Was this translation helpful? Give feedback.
-
eleventyConfig.addDataExtension("yaml", (contents) => yaml.load(contents));this works for me. |
Beta Was this translation helpful? Give feedback.
Re: https://www.11ty.dev/docs/data-custom/#usage
Are you using v2 canary branch? Or the stable v1.0.2 branch?