vitepress
vitepress copied to clipboard
GitHub Pages results in "Hydration completed but contains mismatches"
Describe the bug
When adding a / at the end of the URL using GH pages, the page breaks and results in a "Hydration completed but contains mismatches."
There are similar issues but no solution to this: https://github.com/vuejs/vitepress/pull/3468#issuecomment-1896430259
Reproduction
Visit https://projects.pandermatt.ch/vitepress-demo/markdown-examples/ (after refresh the page works)
Expected URL: markdown-examples.html. The redirect happens, but the page is broken.
URL from external pages or old Search Engine results may include / which results in a bad UX (See Additional context)
Expected behavior
https://projects.pandermatt.ch/vitepress-demo/markdown-examples/ should return a 404 or redirect to home so that the user does not get a broken page.
I don't know if this could be handled in the code? or it is really just a GH pages problem.
My workaround was, to move to Cloudflare pages
System Info
Only on GitHub Pages, see https://github.com/pandermatt/vitepress-demo
Additional context
I noticed this issue while trying to do something with ASDF (not my page, but they use vitepress) and i got redirected to https://asdf-vm.com/guide/getting-started/ from another page.
After navigating, the page still is broken until a reload happens
Validations
- [X] Check if you're on the latest VitePress version.
- [X] Follow our Code of Conduct
- [X] Read the docs.
- [X] Check that there isn't already an issue that reports the same bug to avoid creating a duplicate.
GitHub pages problem. I don't think we can do anything except maybe client side redirection. But that condition is tricky to properly detect.
Maybe we can add this known issue to the documentation in the GitHub hosting section?