-
-
Notifications
You must be signed in to change notification settings - Fork 2.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
feat: add cleanUrls
option (#219)
#869
Conversation
@kiaking I was thinking if instead of providing an option for @georges-gomes Is there any compelling reason that people would want to set |
@brc-dd for people already using VitePress, this would change their URLs... It has a number of impacts for them. |
@kiaking Does it looks good to you? Let me know if I should adjust something. |
Awesome 😍 |
There is These docs had this https://github.com/vuejs/vitepress/pull/724/files#diff-d019d98f93ab320a29453160fbb723955227add7e423571649818128db30c595, https://github.com/vuejs/vitepress/pull/724/files#diff-3193bd261794eacfc0903b854591814239fe7c7737175464622570a374b517db. There might be a few more now. |
Not sure, but we might need to change this too: vitepress/src/client/app/router.ts Line 251 in 753f35b
|
Co-authored-by: Divyansh Singh <[email protected]>
Co-authored-by: Divyansh Singh <[email protected]>
This issue is also there: #412 if you add trailing slash to your URL (shows title 404, etc.). I had fixed this in vite-3 branch itself. |
Also, there is some issue with sidebar. Open this: https://deploy-preview-869--vitepress-docs.netlify.app/guide/getting-started/, now click on configuration in sidebar. URL becomes this: Sorry, the content is not changing. Just the URL is. (and the title) |
This is new, I have to check why. Thanks |
You need to change this |
Should be much better now. |
Yeah, there is no need to disable it. 👍 |
Can you target this to |
Co-authored-by: Divyansh Singh <[email protected]>
Co-authored-by: Divyansh Singh <[email protected]>
@georges-gomes Without trailing slash Netlify is having issue. Open this site for example: https://62c2e731bab5b3761e2ce010--fastidious-stroopwafel-625e87.netlify.app/guide/getting-started |
Is Netlify setup with "Pretty URLs" ? |
No, asset optimization is disabled. |
Having trailing slash will cause other issues like a URL or asset like this
What's the solution here? :/ |
When I use |
The issue is on Vercel too, but on Vercel we can set trailingSlash redirects, so that fixes the stuff there. |
I'm reading that Netlify is biais toward trailing slash in our configuration. I think I'm going to option trailing and non-trailing slash option depending on the hosting solution. Nothing is easy. |
I created the option cleanUrls
When set to When set to When set to Notes:
|
But there is still an issue with the router. It doesn't like trailing slashes. I couldn't find the solution quickly. |
OK trailing slash is fixed. But there is a little challenge: When The |
There are some more issues with clean urls. Like we have relative links in markdown. Click links in the "what's next" section on this page: http://localhost:4173/guide/getting-started/. They aren't being properly resolved. Also prefetching links is not working (see console for errors as you scroll to the bottom). I suppose the links can be handled in the markdown plugin. But there would be a challenge in determining if the page is |
It's starting to require a lot of code to deal with trailing slash... |
I am thinking lets have three options:
Regarding the MPA mode, not nesting will work if the server is configured to rewrite the URLs, otherwise it won't. It will work in MPA if nested. |
I don't understand what you call "nest directories" and "don't nest directory" |
I meant this: /foo.md -> /foo/index.html (create clean directory structure)) |
I don't know if we can do (1) - it would rely of the hosting service to sert |
Fine! 👍 BTW, VuePress also has this warning in place:
|
Done, with nicer documentation. |
cleanUrls
option (#219)
Okay so I've merged these changes to the Vite3 branch with certain changes. Thanks for all the work!! 💚 |
Can you review #856 and verify if the clean urls are working cool with |
Testing soon! |
( Replaces #488 for alpha)
This feature is meant to be working with SPA and MPA mode so it's a little bit bigger than just rename the browser location.
/404.html
(and not/404/index.html
like other pages).fixes #219, fixes #444