feat/site: Add navigation links on 404 page - #1887
Open
marcleblanc2 wants to merge 4 commits into
Open
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
marcleblanc2
marked this pull request as ready for review
September 9, 2026 10:28
marcleblanc2
marked this pull request as draft
September 10, 2026 00:55
…ing ancestor The 404 page only offered a link home. Now it also shows: - "Go back to <path>" when document.referrer is on the same origin - "Go up to <path>" for the closest ancestor of the requested URL that is a real docs page (preview pages excluded), when that is not the root not-found.tsx stays a server component and passes the list of page paths from contentlayer to a small client component, which resolves both links after mount because the prerendered 404 page does not know the browser URL. Amp-Thread-ID: https://ampcode.com/threads/T-01a08450-afc0-7264-afde-d3e2a47be6d2 Co-authored-by: Amp <amp@ampcode.com>
…ent-side navigation document.referrer only reflects the last full page load, so clicking a broken <Link> inside the docs left the 404 page without a back link. A PreviousPathnameProvider in the root layout (which React keeps mounted across client-side navigations) now remembers the prior pathname; the 404 page prefers it and falls back to a same-origin document.referrer on fresh loads. Amp-Thread-ID: https://ampcode.com/threads/T-01a08450-afc0-7264-afde-d3e2a47be6d2 Co-authored-by: Amp <amp@ampcode.com>
Editing the URL bar is a fresh load with no referrer, so the 404 page had nothing to link back to. Persist the visited pathnames in sessionStorage (per tab) so that case works too, and only offer "Go back" when the previous pathname is a real page, since it may itself have been a 404.
Amp-Thread-ID: https://ampcode.com/threads/T-01a088d0-ca60-775c-b1a2-b00c8fc48f6d Co-authored-by: Amp <amp@ampcode.com>
marcleblanc2
force-pushed
the
not-found-back-and-up-links
branch
from
September 10, 2026 01:00
ccbe7a3 to
1041225
Compare
marcleblanc2
marked this pull request as ready for review
September 10, 2026 01:11
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
The 404 page only offered "Go back home". It now also shows, when applicable:
<path>— the docs page the user was on before this one<path>— the closest ancestor of the requested URL that is a real docs page (preview pages excluded). Omitted when that ancestor is the root (the home link covers it) or is the same page as the back link.Before
After