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

404.md file with markdownTemplateEngine as false breaks filename #466

Closed
alex-page opened this issue Mar 27, 2019 · 9 comments
Closed

404.md file with markdownTemplateEngine as false breaks filename #466

alex-page opened this issue Mar 27, 2019 · 9 comments
Assignees
Labels
Milestone

Comments

@alex-page
Copy link

alex-page commented Mar 27, 2019

When using markdownTemplateEngine I set the value as false markdownTemplateEngine: false,. This caused the 404.html to be called <p>/404.html</p>?. This generates folders and an odd file name. Changing the value to njk or liquid seems to fix the problem.

The 404.md looks like:

---
layout: page
pagetitle: 404 page not found
permalink: /404.html
excludeFromSitemap: true
---
# Yikes!

> Dude where's my page!

It seems you have found a missing page. Sorry for any inconvenience.

It feels like a bug however I don't know enough about how the files are rendered.

I hope this helps, thanks for an awesome static site renderer! I have really enjoyed using it! The examples page is great and has made fixing/troubleshooting little issues like this a lot easier.

@alex-page alex-page changed the title 404 markdown file with markdownTemplateEngine as false breaks filename 404.md file with markdownTemplateEngine as false breaks filename Mar 27, 2019
@kleinfreund
Copy link
Contributor

You’re setting markdownTemplateEngine: 'false', but the documentation says

https://www.11ty.io/docs/languages:

htmlTemplateEngine: The default global template engine to pre-process HTML files. Use false to avoid pre-processing and passthrough copy the content (HTML is not transformed, so technically this could be any plaintext).

So you need to set markdownTemplateEngine: false instead. Can you try that?

@alex-page
Copy link
Author

alex-page commented Apr 14, 2019

@kleinfreund my mistake in the example above I am setting a boolean not a string. So the output is still creating a directory called <p>404.html</ with a file named p>.

return {
	dir: {
		input: 'src',
		includes: '_includes',
		output: 'site'
	},
	templateFormats : ['njk', 'md'],
	htmlTemplateEngine : false,
	markdownTemplateEngine: false,
};

@kleinfreund
Copy link
Contributor

@alex-page I see! Alright. So I tried to reproduce this. You’re file is 404.html and its inside the src directory, correct?

I wonder why the file is processed in the first place because you don’t list html as a templateFormat. Can you add that to the configuration and check again? Otherwise, I don’t quite know how to reproduce this exactly. In particular, I’d like to know how your src/_inlcudes/page.njk file looks like.

@alex-page
Copy link
Author

It's 404.md not .html and it is inside the src directory. You can see the project here if you are curious: https://github.com/alex-page/alex-page

Changing the .eleventy.js setting to the one above breaks the output of the page.

@kleinfreund
Copy link
Contributor

I can reproduce this now with the following files and the configuration you provided.

  • src/
    • _includes/
      • page.njk
    • 404.md
  • .eleventy.js

The produced output:

  • site/
    • <p>/
      • 404.html</
        • p>

(Note: All file system objects don’t actually end in a slash above; that’s just for representation here.)

I will look into it now.

@kleinfreund
Copy link
Contributor

@zachleat I don’t get the logic.

In Template.js, permalink is /404.html and out comes a permalinkValue of '<p>/404.html</p>', hence the weird output above.

permalinkValue = await super.render(permalink, data, true);

The TemplateContent.render method always seems to get template content to render, but now it tries to render what was meant as the permalink.

@alex-page
Copy link
Author

Thanks @kleinfreund for digging into this. I should have definitely done a folder structure as an example in the original issue.

@zachleat zachleat added bug and removed needs-triage labels Apr 14, 2019
@zachleat zachleat self-assigned this Apr 14, 2019
@zachleat
Copy link
Member

Ah yes @kleinfreund this is a legitimate bug! I added a test for this if you’re curious what was up!

@alex-page
Copy link
Author

Thank you @zachleat and @kleinfreund really appreciate it <3

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