fix(core, plugin-content-docs): Render `NotFoundContent` via route if `routeBasePath` is `/`
Pre-flight checklist
- [x] I have read the Contributing Guidelines on pull requests.
- [ ] If this is a code change: I have written unit tests and/or added dogfooding pages to fully verify the new behavior.
- [ ] If this is a new API or substantial change: the PR has an accompanying issue (closes #0000) and the maintainers have approved on my working plan.
Motivation
Fixes https://github.com/facebook/docusaurus/issues/9688
The behavior was semi-inspired by option 1 to https://github.com/facebook/docusaurus/issues/9688#issuecomment-1878522911
Test Plan
(Let me know what else needs to happen)
On the repo which reproduces https://github.com/facebook/docusaurus/issues/9688, I made this change (e.g. leveraged my fork) and was successfully able to get a 404 on any /<whatever> page, while still getting the content on the correct docs subroutes.
Test links
Deploy preview: https://deploy-preview-_____--docusaurus-2.netlify.app/
Related issues/PRs
⚡️ Lighthouse report for the deploy preview of this PR
| URL | Performance | Accessibility | Best Practices | SEO | PWA | Report |
|---|---|---|---|---|---|---|
| / | 🟠 74 | 🟢 98 | 🟢 100 | 🟢 100 | 🟠 89 | Report |
| /docs/installation | 🟠 66 | 🟢 98 | 🟢 100 | 🟢 100 | 🟠 89 | Report |
| /docs/category/getting-started | 🟠 74 | 🟢 100 | 🟢 100 | 🟢 90 | 🟠 89 | Report |
| /blog | 🟠 70 | 🟢 100 | 🟢 100 | 🟢 90 | 🟠 89 | Report |
| /blog/preparing-your-site-for-docusaurus-v3 | 🟠 64 | 🟢 97 | 🟢 100 | 🟢 100 | 🟠 89 | Report |
| /blog/tags/release | 🟠 71 | 🟢 100 | 🟢 100 | 🟠 80 | 🟠 89 | Report |
| /blog/tags | 🟠 76 | 🟢 100 | 🟢 100 | 🟢 90 | 🟠 89 | Report |
[V2]
Built without sensitive environment variables
| Name | Link |
|---|---|
| Latest commit | 4d1fd5e9ce2a17b62cba85cbd0a84b0575b25209 |
| Latest deploy log | https://app.netlify.com/sites/docusaurus-2/deploys/659c684247277e000701d791 |
| Deploy Preview | https://deploy-preview-9719--docusaurus-2.netlify.app |
| Preview on mobile | Toggle QR Code...Use your smartphone camera to open QR code link. |
To edit notification comments on pull requests, go to your Netlify site configuration.
Oh, and if y'all want I can (temporarily) change the website to use / as the routeBasePath as a demonstration :+1:
[V2]
Built without sensitive environment variables
| Name | Link |
|---|---|
| Latest commit | 25d45e884a3432d772549a3819c18a0f06ec7169 |
| Latest deploy log | https://app.netlify.com/sites/docusaurus-2/deploys/659db9c9300819000875392c |
| Deploy Preview | https://deploy-preview-9719--docusaurus-2.netlify.app |
| Preview on mobile | Toggle QR Code...Use your smartphone camera to open QR code link. |
To edit notification comments on pull requests, go to your Netlify site configuration.