Closed danburzo closed 3 months ago
The workaround is to use the compileOptions.permalink
option, which can be set to "raw"
in case all permalinks in the project are static.
For dynamic permalinks, the solution depends on a fix to #2777, as they are not currently pre-processed with Liquid/Nunjucks when the Markdown template engine is swapped.
I think a very good case can be made to make the default raw
and encourage permalink callback functions in custom syntaxes by default!
Shipping with 3.0.0-alpha.13
Cool, thanks!
I suppose this change disables permalink templating globally, rendering Use template syntax in Permalink and part of front matter documentation obsolete:
Note that only the permalink and eleventyComputed front matter values can contain variables and shortcodes like you would use in the body of your templates.
The fix here is really to put the permalink under eleventyComputed
(or switch compileOptions.permalink
back to true
). In my case, I keep the path of RSS feed in metadata file and reuse it on various part of the site, including the feed's njk template itself. So I put the following into the template's frontmatter:
---
eleventyComputed:
permalink: "{{ metadata.feed.path }}"
Operating system
macOS Ventura 13.1
Eleventy
^2.0.0-beta.2 / 1.0.2
Describe the bug
Found while poking around replacing the built-in Markdown engine (see #2777) that when setting a replacement with
.addExtension('md', { ... })
, as exemplified in the docs, any explicit permalinks present in the frontmatter of.md
sources will get processed with the replacement engine, as observed a while back (#1019).This is a problem because most Markdown processors (including
marked
andremark
) will wrap a plain string such as/path/to/output/
in<p>
tags, thus breaking the output. I'm not sure if the default engine skips the Markdown step or whethermarkdown-it
simply doesn't wrap a plain string, but the issue only manifests when changing to a different engine.Reproduction steps
Eleventy config:
Content file:
Running Eleventy outputs the HTML to
_site / <p>hello-world / < / p>
.Expected behavior
If permalinks passing through the Markdown engine is inevitable, it would be great to get enough arguments to the
compile()
function for authors to be able to discern when to skip Markdown processing.Reproduction URL
No response
Screenshots
No response