Documentation-only sites do not work if baseUrl is not `/`
See original GitHub issue🐛 Bug Report
A docusaurus site (v2) without a landing page and documentation as the index page does not work if baseUrl is other than /.
It seems like @docusarus-utils.normalizeUrl is generating double forward slashes when routeBasePath is set to a single ‘/’ in the docs plugin configuration.
For a baseUrl: 'metro/' and docs.routeBasePath: '/' the generated routes are:
...
/metro//2.0.0-alpha.43/using-plugins
/metro//2.0.0-alpha.43/using-themes
/metro//2.0.0-alpha.43/versioning
/metro//next/blog
/metro//next/cli
/metro//next/configuration
/metro//next/contributing
/metro//next/creating-pages
...
When navigating to /metro/next/blog, react-router finds no match and the “Page not found” message is loaded instead.
Have you read the Contributing Guidelines on issues?
Yes.
To Reproduce
Using docusaurus’ website/ in the repository as an example:
- Set baseUrlto/metro/in yourdocusaurus.config.js.
- Set routeBasePathto/in the@docusaurus/preset-classic.docssection of yourdocusaurus.config.js.
- Run yarn start
- Navigate to https://localhost:3000/metro/introduction
- "Page not found: is displayed.
Expected behavior
https://localhost:3000/metro/introduction should have loaded the Introduction page (in docs/introduction.md), just like https://localhost:3000/docs/introduction loads it when baseUrl and routeBasePath have their default values.
Your Environment
- Docusaurus version used: 2.0.0-alpha.48
- Environment name and version (e.g. Chrome 78.0.3904.108, Node.js 10.17.0): Node.js v10.19.0
- Operating system and version (desktop or mobile): MacOS X Catalina 10.15.2
Issue Analytics
- State:
- Created 4 years ago
- Comments:10 (1 by maintainers)

 Top Related Medium Post
Top Related Medium Post Top Related StackOverflow Question
Top Related StackOverflow Question
Thanks for the quick response @slorber – moving the directory certainly seems to do the trick for now
In the meantime, I’ll stick with:
@joe-bell this is a bug: https://github.com/facebook/docusaurus/issues/3291
To fix it locally you could probably move
buildtobuild/docsand rundocusaurus serveagain