You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'll preface this with the fact I'm not sure if this is a case of the docs being wrong, or a bug in 11ty.
I'm getting an error when I try to use frontmatter in .njk files, this is what is shown in the 11ty docs, so I assume it's possible (I haven't worked with njk before)
To Reproduce
Follow the docs here (https://www.11ty.dev/docs/layouts/) and create a new layout (myLayout.njk) and a new markdown file (content-using-layout.md)
Use the example code from the docs for the files
Run eleventy --serve
See error
File added: _includes/myLayout.njk
Problem writing Eleventy templates: (more in DEBUG output)
> gray-matter engine "title: My Rad Blog ---" is not registered
`Error` was thrown:
Error: gray-matter engine "title: My Rad Blog ---" is not registered
at module.exports (/Users/matt/.config/yarn/global/node_modules/gray-matter/lib/engine.js:6:11)
at module.exports (/Users/matt/.config/yarn/global/node_modules/gray-matter/lib/parse.js:8:18)
at parseMatter (/Users/matt/.config/yarn/global/node_modules/gray-matter/index.js:109:17)
at matter (/Users/matt/.config/yarn/global/node_modules/gray-matter/index.js:50:10)
at TemplateLayout.read (/Users/matt/.config/yarn/global/node_modules/@11ty/eleventy/src/TemplateContent.js:82:16)
at async TemplateLayout.getFrontMatterData (/Users/matt/.config/yarn/global/node_modules/@11ty/eleventy/src/TemplateContent.js:141:7)
at async TemplateLayout.getTemplateLayoutMapEntry (/Users/matt/.config/yarn/global/node_modules/@11ty/eleventy/src/TemplateLayout.js:55:24)
at async TemplateLayout.getTemplateLayoutMap (/Users/matt/.config/yarn/global/node_modules/@11ty/eleventy/src/TemplateLayout.js:66:20)
at async TemplateLayout.getData (/Users/matt/.config/yarn/global/node_modules/@11ty/eleventy/src/TemplateLayout.js:89:15)
at async Template.getData (/Users/matt/.config/yarn/global/node_modules/@11ty/eleventy/src/Template.js:244:28)
Wrote 0 files in 0.04 seconds (v0.11.0)
Expected behavior
11ty renders the markdown using the layout, as described in the docs.
Environment:
OS and Version: Mac 10.15.4
Eleventy Version 0.11.0
The text was updated successfully, but these errors were encountered:
I was facing the same problem. For me, the error was occurring because the NJK prettier plugin in VS Code converted valid syntax into single line while saving.
That is
---
title: My Rad Blog
---
was converted to (invalid)
--- title: My Rad Blog ---
I disabled the plugin for now. However, I am looking for a better solution.
I was facing the same problem. For me, the error was occurring because the NJK prettier plugin in VS Code converted valid syntax into single line while saving.
...
I disabled the plugin for now. However, I am looking for a better solution.
Oh yeah that was it! Maybe a warning could be added to the docs 🤔
I'll preface this with the fact I'm not sure if this is a case of the docs being wrong, or a bug in 11ty.
I'm getting an error when I try to use frontmatter in .njk files, this is what is shown in the 11ty docs, so I assume it's possible (I haven't worked with njk before)
To Reproduce
myLayout.njk
) and a new markdown file (content-using-layout.md
)eleventy --serve
Expected behavior
11ty renders the markdown using the layout, as described in the docs.
Environment:
The text was updated successfully, but these errors were encountered: