facebook / facebook/docusaurus
Unable to avoid prepending of the baseUrl in NavBar items
- Lingua principale
- TypeScript
- Stelle
- 66.2k
- Fork
- 10k
- Merge medio
- 1g 3h
- PR unite (30g)
- 52
Descrizione
### Have you read the Contributing Guidelines on issues?
- [X] I have read the [Contributing Guidelines on issues](https://github.com/facebook/docusaurus/blob/main/CONTRIBUTING.md#reporting-new-issues).
### Prerequisites
- [X] I'm using the latest version of Docusaurus.
- [X] I have tried the `npm run clear` or `yarn clear` command.
- [X] I have tried `rm -rf node_modules yarn.lock package-lock.json` and re-installing packages.
- [X] I have tried creating a repro with https://new.docusaurus.io.
- [X] I have read the console error message carefully (if applicable).
### Description
Using the `prependBaseUrlToHref` property on NavBar items or `pathname:///` inside `href` property directly doesn't prevent the prepending of the project's `baseUrl` value in the final link.
### Reproducible demo
https://stackblitz.com/edit/github-tvsjbv?file=docusaurus.config.js
### Steps to reproduce
1. Set a `baseUrl` in the docusaurus config file other than `/` (example : `/base/`)
2. Set the docusaurus project as **Docs-only** (docs.routeBasePath : `/`, intro.md slug: `/`, remove `src/pages` folder)
3. Add NavBar links that should point to other place in the same domain. Example:
```js
{
href: '/toto', // or 'pathname:///toto'
prependBaseUrlToHref: false,
label: 'Toto',
position: 'left'
}
```
4. In the broswer go `/base` to get the docs intro page.
5. Check the final `href` value of links inside the NavBar.
### Expected behavior
The navbar item links shouldn't have the `baseUrl` prepended on the `href`
```
https://your-docusaurus-test-site.com/toto
```
### Actual behavior
The navbar item links do have the `baseUrl` prepended on the `href`
```
https://your-docusaurus-test-site.com/base/toto
```
### Your environment
- Public source code: https://stackblitz.com/edit/github-tvsjbv?file=docusaurus.config.js
- Public site URL: https://stackblitz.com/edit/github-tvsjbv?file=docusaurus.config.js
- Docusaurus version used: 2.0.1
- Environment name and version (e.g. Chrome 89, Node.js 16.4): Chrome 104
- Operating system and version (e.g. Ubuntu 20.04.2 LTS): Mac OSX 12.1
### Self-service
- [ ] I'd be willing to fix this bug myself.
Guida per i contributori
Apri la guida per i contributori
Valutazione
Questa issue non è ancora stata valutata.