· Next.js · UX
A 404 that helps
Anyone who follows a broken link deserves more than a bare error. A search field, a smart suggestion and the same glass UI as everywhere else.
This site has two root layouts: one for the language redirect on / and one per language. So there is no shared layout a regular not-found page fits into. Next.js has global-not-found for that: one standalone document used for every unknown URL.
Because it's a single static file, the page picks the language in the browser, from the path or else from your device language. A tiny script does that before first paint, so you never see the wrong language flash.
Type in the search field and the Command Palette takes over straight away, with your first letters already in it. And if the link has a typo, the page compares the last part of the path with every page (Levenshtein distance) and asks: did you mean this?