-
-
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
Webc file breaking permalink in directory data? #50
Comments
The issue is that the The workaround is to use a callback This requires your data file to be module.exports = {
"layout": "page.njk",
"tags": "pages",
"permalink": function(data) {
return `/${page.fileSlug}/`
}
} |
Thanks for the response. I managed to get around it by amending the input directories in the eleventy.config.js like this (a blatant copy from @darthmall's excellent 11ty.webc.fun site):
This negated the need for the directory data file, but it's good to know why this happens and how to get around it. |
Hi, I tried this: function toPermalink(slug) {
let cutPoint = slug.indexOf("_") + 1;
slug = slug.substr(cutPoint);
return `${slug}/`;
};
module.exports = {
"layout": "chapter.webc",
"permalink": data => toPermalink(data.page.fileSlug)
}; Works with .md files but not webc. I get this error:
If I write it like this instead of the arrow function: "permalink": function(data) { return toPermalink(data.page.fileSlug) } I get a different error:
But still works with just .md files |
Operating system
Windows 10
Eleventy
@11ty/eleventy@beta
Describe the bug
I'm getting an error in the terminal when I add a .webc file to a '/pages' directory.
Reproduction steps
I have a directory called '/pages/' with .md files inside it. There is a data file in this directory:
This works fine
BUT
I added a .webc file into that directory with just this markup:
I then get the following error in the terminal:
Original error stack trace: TypeError: link.slice is not a function
Has anyone experienced the same thing?
Expected behavior
I would expect the .webc file to render a page relative to the site route, just like the .md files do.
Reproduction URL
No response
Screenshots
No response
The text was updated successfully, but these errors were encountered: