Before v59 we were able to remove /docs from the URL by setting routeBasePath: '', whilst still being able to use pages see #2713. However, as of v59 routeBasePath can no longer be empty and adding a / to routeBasePath forces docs-only mode and therefore, no pages. This results in nav items to 404. :(
items: [
{
to: '/getting-started',
label: 'Getting Started',
position: 'left',
activeBasePath: 'getting-started',
},
routeBasePath to '' or '/'You should be able to remove /docs from the URL without having to use docs-only mode. We really wanted to update so we can use the DocSearch v3, but this is going to prevent us from doing so. :(
N/A
Thanks! #3120 adds empty string '' to the list of accepted values for routeBasePath.
@Dannyholt , as far as I understand, you want docs to be at the root path, yet being able to provide custom pages also under "/".
Actually we had some important refactors on how docs are handled, as they were quite a few bugs, but we should support this usecase and will probably release a fix soon.
Can you confirm this only affect your homepage? or do you see other pages for which this is a problem?
@teikjun this is not related to the '' value specifically, but to this code that removes the homepage in particulary:
async routesLoaded(routes) {
const homeDocsRoutes = routes.filter(
(routeConfig) => routeConfig.path === homePageDocsRoutePath,
);
// Remove the route for docs home page if there is a page with the same path (i.e. docs).
if (homeDocsRoutes.length > 1) {
const docsHomePageRouteIndex = routes.findIndex(
(route) =>
route.component === options.docLayoutComponent &&
route.path === homePageDocsRoutePath,
);
delete routes[docsHomePageRouteIndex!];
}
},
Anyway as we already planned to remove that code, it should be fixed for the next release.
@slorber
I mentioned this in Discord, but thought i'd mention it here anyway. It actually didn't cause any issue with the homepage or other custom pages as they worked as intended. The issue was the nav items in the header no longer worked went to the doc articles and instead caused a 404.
Hey, this is fixed in https://github.com/facebook/docusaurus/pull/3141
will be released soon, probably tomorrow
released in https://github.com/facebook/docusaurus/releases/tag/v2.0.0-alpha.60
can you tell me if it works?
@slorber
Yes issue is now resolved. Thanks!
Hey,
I think accepting '' as a value was a bad idea that actually lead to errors later, but still think that '/' should work for your usecase. Please tell me if you think you can't use '/' instead, because '' will be rejected in alpha 63.
Most helpful comment
Hey, this is fixed in https://github.com/facebook/docusaurus/pull/3141
will be released soon, probably tomorrow