-
-
Notifications
You must be signed in to change notification settings - Fork 8.7k
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
fix(core, plugin-content-docs): Render NotFoundContent
via route if routeBasePath
is /
#9719
base: main
Are you sure you want to change the base?
Conversation
⚡️ Lighthouse report for the deploy preview of this PR
|
✅ [V2]Built without sensitive environment variables
To edit notification comments on pull requests, go to your Netlify site configuration. |
@@ -43,6 +43,24 @@ export default function ComponentCreator( | |||
}, | |||
}); | |||
} | |||
if (path === '/*') { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This feels hacky, but I'm just not familiar enough with the ecosystem or Docusaurus code to make that call. So here goes 😄
@@ -42,6 +42,14 @@ export function sortConfig( | |||
return -1; | |||
} | |||
|
|||
// Wildcard also should get placed last | |||
if (a.path.endsWith('/*')) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I couldn't decide between a.path == "/*"
or .endsWith
and decided to go with endsWith
since it seemed less magical.
Oh, and if y'all want I can (temporarily) change the website to use |
✅ [V2]Built without sensitive environment variables
To edit notification comments on pull requests, go to your Netlify site configuration. |
NotFoundContent
via route if routeBasePath
is /
NotFoundContent
via route if routeBasePath
is /
c440861
to
25d45e8
Compare
if (param.options.routeBasePath === '/') { | ||
subRoutes.push({ | ||
path: '/*', | ||
component: '@docusaurus/ComponentCreator', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What's the benefit of using ComponentCreator
here instead of NotFound/Content
? Theoretically, couldn't the ComponentCreator("*")
at the end of the routes just use @theme/NotFound
?
Pre-flight checklist
Motivation
Fixes #9688
The behavior was semi-inspired by option 1 to #9688 (comment)
Test Plan
(Let me know what else needs to happen)
On the repo which reproduces #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