[Bug and fix] The build fails when using frontmatter permalink: false
samimaat opened this issue · 2 comments
Firstly, thanks for the template!
I noticed when trying to implement a "draft mode" (11ty.dev) to the template that it doesn't build when the draft mode is on. I figured out that this is because the draft mode uses "permalink: false" in the mix.
This causes a build error with the helpers.js file in the getLinkActiveState function and in this part:
if (itemUrl.length > 1 && pageUrl.indexOf(itemUrl.replace('/page-0/', '')) === 0) {
response += 'data-state="active"';
}
The error has to do with using pageUrl.indexOf on a permalink that doesn't exist or is set to false (I think). This can be fixed by using an if statement (or maybe something more elegant that I couldn't think of):
if (pageUrl === !false) {
}
Together like this:
if (pageUrl === !false) {
if (itemUrl.length > 1 && pageUrl.indexOf(itemUrl.replace('/sivu-0/', '')) === 0) {
response += 'data-state="active"';
}
}
Hi Sami!
Have you already implemented the changes I made to the helper.js
file?
--> 84b0ea9#diff-d53ac0fd6115f1597a83a9e8e5825dc425b8b0cf9db4c82be6c4dd7d0c23f3ad
No, I haven't! Thanks. In this case the issue can be closed.