-
-
Notifications
You must be signed in to change notification settings - Fork 10
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Permalink errors when using pagination #42
Comments
I haven't seen it suggested anywhere, but |
Note that while So if this is in front matter via YAML, you’ll likelywant: ---
permalink: "'/' + slugify(item.title) + '/'"
--- (assuming item is the alias from your pagination settings) but any arbitrary JS would work so I’d expect this to work too: ---
permalink: "`/${slugify(item.title)}/`"
--- |
You could also use a JS function for this as well (with JS front matter) and bypass the webc parsing altogether: ---js
{
permalink: function(data) {
return "`/${this.slugify(data.item.title)}/`";
}
}
--- https://www.11ty.dev/docs/data-frontmatter/#javascript-front-matter |
Gotcha, thanks. I guess it's implied by "Use template syntax in permalink" that the syntax should match the template language, but I've only ever used or seen Liquid/Nunjucks permalink templates. |
Yeah, I think post-2.0 release WebC will start to play a more prominent role as a first-party language on the docs, which should help with some of this confusion. Thanks! |
Describe the bug
When rendering a paginated page that is a
.webc
component, I'm getting syntax or type errors depending on the permalink template.To Reproduce
My setup is the same as in #36, but using the current
@11ty/eleventy
2.0.0-canary.24
and@11ty/eleventy-plugin-webc
0.8.1
.With
permalink: "thing/{{item.title | slugify }}/"
as in the original:With
permalink: "/{{item.title | slugify }}/"
(i.e. dropping the directory prefix):With
permalink: "{{item.title | slugify }}/"
(i.e. dropping the directory prefix and leading/
):The
<template webc:nokeep>
solution from this comment also doesn't appear to work.These errors also occur using @11ty/eleventy 2.0.0-canary.16 and @11ty/eleventy-plugin-webc 0.7.0, which seems to be the configuration reported fixed in #36, so I'm not sure what I'm doing wrong.
The text was updated successfully, but these errors were encountered: