-
Notifications
You must be signed in to change notification settings - Fork 973
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
Allow prerendering NotFoundPage as 404.html #1891
Conversation
Curious if we should add this as a default setup for new projects (i.e. prerender NotFoundPage) — is there a downside? |
Only downside is they're not prepared for their NotFoundPage to be prerendered. Maybe they use a library that doesn't work in Node.js? |
mockedRoutes = [ | ||
{ | ||
name: 'bazinga', | ||
path: '/bazinga', | ||
name: undefined, |
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 is how structure outputs NotFoundPages
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.
would path: "some-unknown-path"
not be more clearly indicate intent? Or doesn't that work in this case?
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.
Hey 👋 Joeren!
We're mocking the output of the redwoodjs/structure package here. This is just what it outputs, when it comes across a route with a not found prop.
<Route notfound page={NotFoundPage} prerender />
The code that deals with that actually doesn't really care about the values of name/path, i've just made this change to more accurately represent what structure does.
Understood that could be unexpected and hard to diagnose, especially given that at this time there would be no errors locally but only at the time of deploy. Even though it wouldn't be breaking, definitely not ideal. This gives me a couple of ideas I'll table for now. Thanks and carry on! |
@@ -81,10 +81,10 @@ export const runPrerender = async ({ | |||
} | |||
|
|||
if (outputHtmlPath) { | |||
// Copy default index.html to defaultIndex.html first | |||
// Copy default index.html to 200.html first |
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?
Why 404.html?
https://docs.netlify.com/routing/redirects/redirect-options/#custom-404-page-handling