Describe the bug
When adding a custom template format with addTemplateFormats and addExtension the result of the compile is added to the filename whenever a permalink property exists in front-matter:
To Reproduce
Steps to reproduce the behavior:
Important things to note:
eleventyConfig.addTemplateFormats("new");
eleventyConfig.addExtension("new", {
compile: () => () => "Test content - this gets included in the filename",
});
permalink value in the filenameExpected behavior
The filename for the page is derived from the permalink - not content.
Environment:
I have test to reproduce here: https://github.com/MadeByMike/eleventy/tree/fix-custom-engine-perma
Resolved the cause - The mdx template and this example here ignore the input string and return content from the file-system (or a fixed string in this case) when the dynamic permalink setting is true. Because of the dynamic import MDX needs to resolve from the inputPath and not the string extracted by 11ty.
Best work-around for my needs that I can think of is to check if the string matches the file. I understand that we probably don't want to add additional context to these .compile functions as they follow the pattern of other template engines... maybe mdx's webpack requirements are special. I do wish I could avoid them entirely.
Sounds like this is the same issue? https://github.com/11ty/eleventy-plugin-vue/issues/6
Closing as duplicate of #1365
@MadeByMike this is #1365!
Reopening this until we know what鈥檚 going on 馃槄
Most helpful comment
@MadeByMike this is #1365!