-
-
Notifications
You must be signed in to change notification settings - Fork 2.3k
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
Configurable 'clean url' in client router #219
Comments
Thanks for the feedback! Interesting. Sounds nice, but the concern would be it might be misleading for people who are not using advanced hosting such as Vercel. If we have option like /index.html
/guide/getting-started/index.html I guess we need to be extra careful when designing spec if we were to add this feature 🤔 |
This would be a nice feature to be able to have it as /about instead of /about.html |
FYI the issue mentioned by @jalt007 happens with Cloudflare Pages, but unlike vercel, there is no way to run it off. It also causes web analytics numbers to be duplicated. https://developers.cloudflare.com/pages/platform/serving-pages#route-matching |
Not being able to configure usage of Clean URLs is a big blocker that has already cost vue/vitepress high profile users like tailwind's author who ultimately went with Next.js for tailwind's docs: It would've also been a blocker for us to be able to use vue/vitepress but managed to create a hack to remove the offending client router LOC that auto appends '.html' suffixes: {
"scripts": {
"postinstall": "node -e \"var fs=require('fs'),js='node_modules/vitepress/dist/client/app/router.js';fs.writeFileSync(js,fs.readFileSync(js,'utf8').replace(\\\"url.pathname += '.html';\\\",''))\""
}
} This is enough for us to continue with evaluation of vitepress but obviously we'd feel more confident if this popular SSG feature was a supported option. |
Is your feature request related to a problem? Please describe.
In production it may be desirable to strip the
.html
extension in urls. Of course this isn't a direct concern of vitepress, and typically static hosts provide a turnkey setting to do this e.g; https://vercel.com/docs/configuration#project/clean-urlsHowever the client side router will append
.html
to the history push state when navigating:This will result in an extra server redirects when e.g. sharing urls, doing hard reloads; that ideally could be avoided.
Describe the solution you'd like
To be able to configure this
.html
appending behaviour on the client router :)The text was updated successfully, but these errors were encountered: