-
Notifications
You must be signed in to change notification settings - Fork 5.3k
Danny/fixing docs apps redirect #16478
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
base: master
Are you sure you want to change the base?
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎ 3 Skipped Deployments
|
WalkthroughThis update removes a permanent redirect rule from the Next.js configuration that previously redirected all Changes
Sequence Diagram(s)sequenceDiagram
participant User
participant Next.js App
participant Custom404 Component
User->>Next.js App: Requests non-existent page
Next.js App->>Custom404 Component: Renders 404 page
Custom404 Component->>User: Displays "Page not found" message
Custom404 Component->>Next.js App: Triggers router.replace('/')
Next.js App->>User: Redirects to home page
Possibly related PRs
Poem
Warning There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure. 🔧 ESLint
docs-v2/pages/404.tsxOops! Something went wrong! :( ESLint: 8.57.1 Error [ERR_MODULE_NOT_FOUND]: Cannot find package 'jsonc-eslint-parser' imported from /eslint.config.mjs 📜 Recent review detailsConfiguration used: CodeRabbit UI ⛔ Files ignored due to path filters (1)
📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
⏰ Context from checks skipped due to timeout of 90000ms (1)
✨ Finishing Touches
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
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.
Actionable comments posted: 0
🧹 Nitpick comments (2)
docs-v2/pages/404.tsx (2)
4-10
: Consider adding a delay before redirectionThe current implementation immediately redirects users to the home page, which might not give them enough time to read the error message. Consider adding a short delay (2-3 seconds) to allow users to see and understand the 404 message before being redirected.
useEffect(() => { // 302 redirect (temporary) to home page - router.replace('/') + setTimeout(() => { + router.replace('/') + }, 3000) // 3 second delay before redirect }, [router])
12-19
: Improve accessibility and semantics of the 404 pageWhile the layout works well, consider these improvements:
- Use semantic HTML for error pages
- Add appropriate ARIA roles and attributes
- Consider using a styled component or CSS module instead of inline styles for consistency with the rest of the application
return ( - <div style={{ display: 'flex', justifyContent: 'center', alignItems: 'center', height: '100vh' }}> - <div> - <h1>Page not found</h1> - <p>Redirecting to home page...</p> - </div> - </div> + <main + style={{ display: 'flex', justifyContent: 'center', alignItems: 'center', height: '100vh' }} + role="alert" + aria-labelledby="error-title" + > + <div className="error-container"> + <h1 id="error-title">Page not found</h1> + <p>Redirecting to home page...</p> + </div> + </main> )
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (2)
docs-v2/next.config.mjs
(0 hunks)docs-v2/pages/404.tsx
(1 hunks)
💤 Files with no reviewable changes (1)
- docs-v2/next.config.mjs
🔇 Additional comments (2)
docs-v2/pages/404.tsx (2)
1-2
: Imports look good!The imports correctly include the necessary React and Next.js hooks for implementing a redirect-based 404 page.
4-20
: Consider SEO implications of auto-redirecting 404 pagesAutomatically redirecting from a 404 page to the home page can affect how search engines index your site. Search engines prefer that non-existent URLs return proper 404 status codes without redirects.
For documentation sites, consider:
- Maintaining the 404 status without redirecting
- Adding helpful navigation options instead of automatic redirection
- If redirection is required, ensure the server still returns a 404 status code first
Before implementing this change, confirm if automatic redirection is the desired behavior for all 404 cases, especially for SEO considerations.
…mHQ/pipedream into danny/fixing-docs-apps-redirect
…mHQ/pipedream into danny/fixing-docs-apps-redirect
WHY
Summary by CodeRabbit
New Features
Chores