Data from .yml is not included in item.ejs locals
jtleniger opened this issue · comments
I'm trying to define navigation with a .yml
file, and then create a nav template that is included in a header template, which is then included in all posts.
From what I can gather, data from top level .yml
isn't included in locals for templates defined with item.ejs
.
Steps to reproduce:
- Create a
.yml
data file at the top level of the site - Create an
index.ejs
and outputJSON.stringify(locals)
; note that the.yml
is present here - Create a subdirectory with a
.md
file, and aitem.ejs
file which outputsJSON.stringify(locals)
; note that the markdown data is present but none of the data from the top level.yml
file is present
It's due to the way root variables are inherited through prototypal inheritance — this is why they don't show up through stringifying. You can still access them through e.g. locals.root.data.foo
. Can you try?
D'oh! Didn't realize that was how root worked. Thank you.