Example of custom permalink in frontmatterdata broken on supplied data documentation
CanIGetaPR opened this issue · comments
CanIGetaPR commented
---
permalink: "{{ page.filePathStem }}.html"
---
Yields:
[11ty] Problem writing Eleventy templates: (more in DEBUG output)
[11ty] Unexpected token '.' (via SyntaxError)
[11ty]
[11ty] Original error stack trace: evalmachine.<anonymous>:1
[11ty] {{ page.filePathStem }}.html
[11ty] ^
[11ty]
[11ty] SyntaxError: Unexpected token '.'
[11ty] at new Script (node:vm:100:7)
[11ty] at createScript (node:vm:265:10)
[11ty] at Object.runInNewContext (node:vm:306:10)
Using 11ty 2.0.1 and that's in a webc file.
Zach Leatherman commented
fyi WebC requires WebC syntax in permalink
CanIGetaPR commented
I can't figure out what WebC syntax is in yaml front matter data in general. Everything gets treated as a string instead of expanding variables.
I can try using js front matter data but the result is a failure because js front matter data does not get context including this, or page.
---js
{
layout: "page-layout.webc",
permalink: page.filePathStem + ".html"
}
---
I don't need to modify the permalink variable in front matter data for any reason anymore, but I'm a bit bothered that I couldn't figure out the equivalent of that example in webc.