Closed solution-loisir closed 1 year ago
I'm getting a syntax error when defining dynamic permalink in JS frontmatter like above or in JS data file (see also the comments in #32).
For this frontmatter:
---js
{
title: "About",
description: "This page explains what WebC is all about!",
lang: "en",
permalink: function(data) {
return "`/${this.slugify(data.title)}/`";
}
}
---
I get this error:
Function statements require a function name (via SyntaxError)
Maybe I doing something wrong. As stated in #42, using dynamic attribute syntax in YAML frontmatter does work ex.
permalink: "`/${page.fileSlug}/`"
It just doesn't seem to work in JS for me.
Seems to be the same issue as #50, and especially to this comment.
Duplicate of #32, please subscribe over there!
Related: #47 #52
https://www.11ty.dev/docs/data-frontmatter/#javascript-front-matter
Originally posted by @zachleat in https://github.com/11ty/eleventy-plugin-webc/issues/42#issuecomment-1374153546