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 not picked up from default layout #2298

Closed
kvibber opened this issue Mar 31, 2022 · 4 comments
Closed

Front matter not picked up from default layout #2298

kvibber opened this issue Mar 31, 2022 · 4 comments
Labels

Comments

@kvibber
Copy link

kvibber commented Mar 31, 2022

If I define a default layout using the _data/layouts.js method described in #380, anything set in the front matter of the layout isn't actually available through the data cascade. Front matter from the template is available, the layout gets applied, but the front matter from the layout is missing.

If I specify the layout directly in the page template, or if I use the subdir/subdir.json method to set a default, the data cascade works as documented and picks up values from the layout's front matter.

For now I've just switched to the subdir.json method, so I've got a workaround.

This is with 11ty 1.0.0.

@pdehaan
Copy link
Contributor

pdehaan commented Mar 31, 2022

Maybe a good news/bad news situation here...
I created a simple repo which should illustrate the issue: https://github.com/pdehaan/11ty-2298 (I hacked the permalink frontmatter so it would write version specific index HTML pages if you wanted to look at the generated www/ files).

I verified in 0.12.1, 1.0.0, 1.0.1-canary.3, and 2.0.0-canary.4 and got the following results:

VERSION RESULT INSTALL NOTES
0.12.1 <head data-front="matter"> npm i @11ty/eleventy@0.12 -D 👍
1.0.0 (latest) <head data-front=""> npm i @11ty/eleventy@latest -D
1.0.1-canary.3 <head data-front="matter"> npm i @11ty/eleventy@1.0.1-canary.3 -D 👍
2.0.0-canary.4 (canary) <head data-front="matter"> npm i @11ty/eleventy@canary -D 👍
npm info @11ty/eleventy dist-tags --json

{
  "latest": "1.0.0",
  "beta": "1.0.0-beta.10",
  "canary": "2.0.0-canary.4"
}

So it looks like it worked in 0.12, broke in 1.0.0, but has been fixed in 1.0.1 (which isn't released yet).

@kvibber
Copy link
Author

kvibber commented Mar 31, 2022

Good to know! Thanks!

@zachleat zachleat added this to the Eleventy 1.0.1 milestone Apr 11, 2022
@zachleat zachleat added the bug label Apr 11, 2022
@zachleat
Copy link
Member

Putting this in the 1.0.1 milestone and closing as fixed. Working on getting a 1.0.1 stable release out now—please retest and confirm when it’s out!

Thank you!

@kvibber
Copy link
Author

kvibber commented May 5, 2022

Confirmed: it's working as expected in 1.0.1. Thanks!

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

No branches or pull requests

3 participants