Eleventy: 404.md file with markdownTemplateEngine as false breaks filename

Created on 27 Mar 2019  路  9Comments  路  Source: 11ty/eleventy

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.

bug

All 9 comments

You鈥檙e 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?

@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,
};

@alex-page I see! Alright. So I tried to reproduce this. You鈥檙e 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鈥檛 list html as a templateFormat. Can you add that to the configuration and check again? Otherwise, I don鈥檛 quite know how to reproduce this exactly. In particular, I鈥檇 like to know how your src/_inlcudes/page.njk file looks like.

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.

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鈥檛 actually end in a slash above; that鈥檚 just for representation here.)

I will look into it now.

@zachleat I don鈥檛 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.

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

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

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

Was this page helpful?
0 / 5 - 0 ratings

Related issues

aaronstezycki picture aaronstezycki  路  3Comments

zellwk picture zellwk  路  3Comments

zachleat picture zachleat  路  3Comments

DirtyF picture DirtyF  路  3Comments

nebrelbug picture nebrelbug  路  3Comments