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

Template engine of content affects front matter of layout #446

Closed
thejohnfreeman opened this issue Mar 13, 2019 · 4 comments
Closed

Template engine of content affects front matter of layout #446

thejohnfreeman opened this issue Mar 13, 2019 · 4 comments
Labels
Milestone

Comments

@thejohnfreeman
Copy link

thejohnfreeman commented Mar 13, 2019

The inputs:

  • In my template: templateEngineOverride: md
  • In the template's directory data file: layout: post.njk
  • In post.njk: permalink: "blog/{{ page.date | date: '%Y/%m/%d' }}/{{ title | slug }}/index.html"

The output:

Writing _site/<p>blog/{{ page.date | date: '%Y/%m/%d' }}/{{ title | slug }}/index.html</p>
 from ./src/blog/2012-03-23-template-inheritance-for-handlebars.md.

Totally unexpected. No actual file is written at that location, of course. Perhaps Eleventy swallows the "not a legal file name" error? (I was looking in the wrong directory.)

If I set markdownTemplateEngine in the .eleventy.js configuration, the same thing happens, which means every post overwrites the same file.

@thejohnfreeman
Copy link
Author

For users: my workaround to disable the template language for my content is to wrap it all, head to toe, in {% raw %} ... {% endraw %}.

@zachleat
Copy link
Member

Hmm… I agree that is is unfortunate. It does seem strange to me that you’d use a nunjucks file but not want nunjucks rendered?

It seems almost as though you want an engine override to apply only to the permalink. Something like permalinkTemplateEngineOverride.

It will take some persuasion to classify this as a bug and not a feature request though.

@zachleat
Copy link
Member

zachleat commented Mar 21, 2019

Oh oh, hmm I misread your issue and glossed over your use of layout here entirely, sorry about that. I definitely agree this is a bug.

@zachleat
Copy link
Member

Created a repro gist https://gist.github.com/zachleat/f199e9b0856337506e13a486d96514ad that exhibited this issue with Eleventy 0.7.1. This issue was fixed with Eleventy 0.8.0.

Sorry for the late reply! 0.8.0 was released April 2019 https://github.com/11ty/eleventy/releases/tag/v0.8.0

zachleat added a commit that referenced this issue Feb 16, 2020
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

2 participants