fix: add styled 404 page to docs website#743
fix: add styled 404 page to docs website#743DhruvGoyal404 wants to merge 1 commit intokeploy:mainfrom
Conversation
There was a problem hiding this comment.
Pull request overview
This PR replaces the auto-redirect behavior on 404 pages with a fully styled, user-friendly error page that provides clear navigation options and helpful resources for users who land on non-existent pages.
Key Changes:
- Replaced automatic redirect with a styled 404 page featuring informative messaging
- Implemented responsive two-column layout with illustration and navigation buttons
- Added dark/light mode support using Docusaurus theme variables
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
src/theme/NotFound/Content/index.js
Outdated
| // Check if there's previous page in history | ||
| if (window.history.length > 1) { | ||
| history.goBack(); | ||
| } else { | ||
| // If no history, go to home | ||
| history.push('/docs/'); | ||
| } |
There was a problem hiding this comment.
The condition window.history.length > 1 is not a reliable way to check if there's a previous page in the browsing history. The window.history.length property includes forward history entries and always includes the current page, so it will typically be >= 1 even when there's no previous page to go back to.
This means users who navigate directly to a 404 page (e.g., by typing a URL or following an external link) will still see the "Go to Previous Page" button, but clicking it will navigate them to /docs/ anyway since goBack() won't work as expected.
Consider either removing the conditional check and always using history.push('/docs/') as a fallback, or implementing a more robust solution such as tracking navigation state or simply always redirecting to the home page when the button is clicked.
| // Check if there's previous page in history | |
| if (window.history.length > 1) { | |
| history.goBack(); | |
| } else { | |
| // If no history, go to home | |
| history.push('/docs/'); | |
| } | |
| // Always go to docs homepage to avoid unreliable history checks | |
| history.push('/docs/'); |
There was a problem hiding this comment.
Hey @DhruvGoyal404 , the changes look really good, However, from our side, we don’t want to include any bunny image or custom design for the 404 page.
If a user types a 404 URL or visits a non-existent page, it should simply redirect to /docs (the docs homepage). Please update it accordingly. Also please fix the Copilot suggestions.
|
Sure @Achanandhi-M sir, onto it, will update with the work asap! |
|
@Achanandhi-M Sir, I've updated the PR as requested! Changes made:
New implementation: Please let me know if any other changes are needed! |
|
Hey @DhruvGoyal404, could you please fix the failing pipelines? Also, please add a short video showing your changes—it will make the review easier for me. Thanks! |
bb5bed3 to
83b7dbc
Compare
|
@Achanandhi-M Sir, I've fixed all the failing pipelines! Changes made:
Demo video: Untitled.design.1.mp4The video shows the 404 page instantly redirecting to [/docs/] from any invalid URL.
All checks should pass once you approve the workflows. Ready for review! |
Achanandhi-M
left a comment
There was a problem hiding this comment.
Hey @DhruvGoyal404, I noticed that many files were changed that don’t seem necessary for this commit. Could you please review and fix those issues? Thanks!
2d6c0ab to
874c3f9
Compare
Fixes #3441 Updated NotFound component to automatically redirect users to /docs/ Signed-off-by: Dhruv Goyal <dhruv621999goyal@gmail.com>
874c3f9 to
178851d
Compare
|
@Achanandhi-M Sir,
The working video was attached previously for your ease of review! The PR now contains only the 404 redirect functionality. Could you please re-review? Thanks! |

Description
Fixes keploy/keploy#3441
This PR adds a styled 404 page to the Keploy docs website, replacing the current auto-redirect behavior.
Problem
Currently, when users navigate to non-existent pages (e.g.,
/docs/xyz), they are automatically redirected to /docs/ without any feedback, causing confusion.Solution
Implemented a fully styled 404 page with:
Changes Made
static/img/404-not-found.png(bunny illustration)static/img/error-404.png(alternative 404 image)Screenshots
Desktop View:

Mobile View:

Dark Mode:

Testing
✅ Tested on invalid routes (
/docs/this-does-not-exist)✅ "Back to Home" button works
✅ "Go to Previous Page" button works
✅ Responsive layout verified (mobile + desktop)
✅ Dark/Light mode toggle verified
✅ No console errors
Checklist