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
Describe the bug
Layout front matter data is incorrectly merged with template front matter data when the layout property is in a global data file, for example, "_data/layout.json".
To Reproduce
Steps to reproduce the behaviour:
Create a new empty eleventy project.
Create a new layout _includes/my_layout.liquid with contents:
---
test: test
---
<h2>Content from the layout is displayed</h2>
{{ content }}
Create a global data file _data/layout.json with contents: "my_layout.liquid".
Create a new template index.liquid with contents:
---
# layout: my_layout.liquid
---
<h1>Value of "test" from layout front matter data: {{ test }}</h1>
Serve the site and notice that the rendered HTML is <h2>Content from the layout is displayed</h2>\n<h1>Value of "test" from layout front matter data: </h1>.
Expected behaviour
The value of "test" should be displayed in the <h1> element.
This is made evident by the behaviour when the layout is explicitly specified in the template (by uncommenting the line in the front matter of index. liquid for example).
Screenshots
When setting the layout using a global data file:
When setting the layout using the template's front matter:
Environment:
OS and Version: Linux (Pop!_OS/Ubuntu) 21.10
Eleventy Version: 1.0.0
Additional context
The bug also appears when setting the layout property using the following:
a directory data file
a global data file
the configuration API's addGlobalData
The bug does not appear when setting the layout property from the following:
frontmatter data in the template
a template data file
The text was updated successfully, but these errors were encountered:
Describe the bug
Layout front matter data is incorrectly merged with template front matter data when the layout property is in a global data file, for example, "_data/layout.json".
To Reproduce
Steps to reproduce the behaviour:
Create a new empty eleventy project.
Create a new layout
_includes/my_layout.liquid
with contents:Create a global data file
_data/layout.json
with contents:"my_layout.liquid"
.Create a new template
index.liquid
with contents:Serve the site and notice that the rendered HTML is
<h2>Content from the layout is displayed</h2>\n<h1>Value of "test" from layout front matter data: </h1>
.Expected behaviour
The value of "test" should be displayed in the
<h1>
element.This is made evident by the behaviour when the layout is explicitly specified in the template (by uncommenting the line in the front matter of
index. liquid
for example).Screenshots
When setting the layout using a global data file:
When setting the layout using the template's front matter:
Environment:
Additional context
The bug also appears when setting the
layout
property using the following:addGlobalData
The bug does not appear when setting the
layout
property from the following:The text was updated successfully, but these errors were encountered: