-
-
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
fix: handle cleanUrls with subfolders when using a trailing slash #1575
fix: handle cleanUrls with subfolders when using a trailing slash #1575
Conversation
07a4fcd
to
3c64778
Compare
Dev appears to be broken after this if we have some path like |
What is the expected behavior when you have
(note, I'll push up the above change, just wanted to clarify if it's working as intended, or we need additional logic somewhere) |
/guide/markdown --> /guide/markdown.md /guide/markdown/ --> /guide/markdown.md or /guide/markdown/index.md whichever exists if (cleanUrls === 'with-subfolders') else /guide/markdown/index.md |
Ok, then we need some additional logic, with the above it works as before for the most part in dev mode:
|
Yeah, push it anyway though. If everything is working for the other two options and we can fix build properly for with-subfolders + trailing-slash, then that's fair too. |
The main change is that when using
with-subfolders
the page should always be generated as/page_name.md
->/page_name_index.md
(since it's generated as/page_name/index.html
On the client side, whether or not there's a trailing slash, it resolves to the
_index
file when usingcleanUrls.with-subfolders
.Still need to check if this works/breakswithout-subfolders
.Also need to clean up, there's duplicated logic now in various places.There is one thing to note about relative links, since they are resolved by the browser, they look for the last
/
in the url, and resolve them relative to that. So depending on how the host redirects and handles trailing slashes, relative URLs might break.For example, /pageA.md would produce the following files:
And these depending on the hosting can end up with the following urls in the browser (excluding what vue-router would normally produce for internal links):
And depending on the url, a
./pageB
link would resolve like thisSo depending on the hosting, relative URLs might break, even with
cleanUrls
disabled./cc @brc-dd
fixes #1442.