-
-
Notifications
You must be signed in to change notification settings - Fork 2k
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
If I use the canonicalUrl example syntax in vitepress version 1.2.2, an error occurs when building. #3923
Comments
Please share a reproducible example. Most likely your canonicalUrl variable is undefined in some case. Try wrapping the head.push statement inside a condtion. |
The reproduction has been corrected. Versions prior to v1.2.2 build with the same code without issue. |
It still is not reproducible.
Like I said, you might have some attribute value that is not a string. |
If I run it in developer mode, there is no problem, but if I just run the build, the following error occurs. If I comment out the canonical syntax, it builds without a problem.
|
I just found the cause, and found that the replace used in the canonicalUrl variable is not the cause, but occurs in pageData.description. I have a document where the description is written in multiple lines, and I found out that this was causing the problem. If pageData.description is in Array format, no error occurs as it is arbitrarily changed to join to string. |
Previous escape function was more lax and incorrectly serialised such values. pageData.description should always be a string unless you’ve wrong frontmatter. Most likely it wouldn’t have worked correctly with older versions too. Sure they won’t throw error, but the generated html tags will be wrong. Closing as it’s not a bug with VitePress rather wrong content. |
Describe the bug
If I use the canonicalUrl example syntax in vitepress version 1.2.2, an error occurs when building.
str.replace is not a function
So, I downgraded to version 1.2.1 and the error did not occur.
Reproduction
install Vitepress v 1.2.2
canonicalUrl example canonical ex
npm run docs:build
Expected behavior
failed to build
occur error => str.replace is not a function
System Info
Additional context
No response
Validations
The text was updated successfully, but these errors were encountered: