Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Front matter data from a layout specified by addGlobalData is ignored #2145

Closed
j-f1 opened this issue Dec 21, 2021 · 1 comment
Closed

Front matter data from a layout specified by addGlobalData is ignored #2145

j-f1 opened this issue Dec 21, 2021 · 1 comment
Assignees
Labels

Comments

@j-f1
Copy link
Contributor

j-f1 commented Dec 21, 2021

Describe the bug
Eleventy’s data cascade merges front matter data from the current page’s layout. However, the code only looks at the local data and the page’s front matter for the layout key, meaning that a default layout specified as global data is not included here.

eleventy/src/Template.js

Lines 384 to 386 in 36fc4b7

let layoutKey =
frontMatterData[this.config.keys.layout] ||
localData[this.config.keys.layout];

To Reproduce
Steps to reproduce the behavior:

  1. Clone this repo: https://github.com/j-f1/eleventy-issue-2145
  2. npm install
  3. npm eleventy
  4. View the contents of _site/*.html. Note that some_data is available to both the template and the page in front-matter-layout.html, but completely missing from global-layout.html.

Expected behavior
Both .html files show the value “Hello, world!” in the quotes

Environment:

  • OS and Version: macOS 12.1 (21C52)
  • Eleventy Version 1.0.0-canary.48
@zachleat
Copy link
Member

Thank you! This will ship with 1.0.1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants