-
-
Notifications
You must be signed in to change notification settings - Fork 8.5k
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
Multi-instance docs with baseUrl doesn't work #5799
Comments
Agree, it seems our route ordering logic does not handle baseUrl and Related to #5645 @lex111 do you want to fix it? Note I found some interesting route ranking algo in ReachUI recently: https://reach.tech/router/ranking |
Do you mean just add support for |
An easy and fast fix (if introducing router ranking it's complex) could be:
- sortConfig(pluginsRouteConfigs)
+ sortConfig(pluginsRouteConfigs, context.siteConfig.baseUrl); SortConfig url checking with baseUrl: - if (a.path === "/" && b.path !== "/") {
- return 1;
- }
- if (a.path !== "/" && b.path === "/") {
- return -1;
- }
+ if (a.path === baseUrl && b.path !== baseUrl) {
+ return 1;
+ }
+ if (a.path !== baseUrl && b.path === baseUrl) {
+ return +1;
+ } |
Yes, that's what I meant, it should work. |
🐛 Bug Report
Prerequisites
npm run clear
oryarn clear
command.rm -rf node_modules yarn.lock package-lock.json
and re-installing packages.Description
Basically adding a
baseUrl
to our config, and two docs one pointing to "/" and other to "/example", "/example" won't work.Have you read the Contributing Guidelines on issues?
Yes
Steps to reproduce
https://stackblitz.com/edit/github-fjbw7h?file=docusaurus.config.js
Here it is a reproducible repo, you can check that chaning
baseUrl
to "/" will make it work, or keeping the "/latest/" but adding a baseUrl to "/" docs path.Expected behavior
(Write what you thought would happen.)
baseUrl
like:/latest/
/latest/{docURL}
(without /docs/ prefix)latest/{routeBasePath}/{docUrl}
I entered on debug mode and I think the problem is that the router since it is not exact, it tries to navigate to the first group to routes, but on there isn't the /latest/forms/.
Not sure how we can fix this ^^
Actual behavior
It should navigate correctly.
Reproducible demo
https://stackblitz.com/edit/github-fjbw7h?file=docusaurus.config.js
The text was updated successfully, but these errors were encountered: