html
Technical notes on web development, DevOps, and AI integration.
2 articles
- 13:49frontend
Why I Stopped Patching HTML lang Client-Side in Next.js
Moving the root layout into the [locale] segment makes html lang server-rendered, deletes the client-side language bootstrap, and passes the structural audit.
TL;DR: We replaced a client-side script that guessed the reader's language with Next.js's recommended pattern: nesting the root layout under a dynamic locale segment so the lang attribute renders correctly on the server. This brought free 404s for unknown locales, static prerendering, and correct screen-reader pronunciation, even on 404 pages. Detection now lives in an Accept-Language redirect instead.
#nextjs#i18n#html - 01:38frontend
Merging HTML Fragments in React ArticleBody
A tiny ArticleBody bug made paragraphs split and spacing drift. The fix was not a parser rewrite, just merging consecutive HTML fragments.
#react#frontend#html