Files
flatpark/functions
KomhandClaude Opus 5 d6818d655c feat(site): send / to the reader's locale at the edge
A Chinese reader arriving at flatpark.org had to find the globe menu before
seeing a word of Chinese. Negotiate it instead, on the one URL that is
ambiguous: a Pages Function on `/` reads Accept-Language and 302s to
`/zh-Hans/` when that is what the browser asks for.

Scoped to the root on purpose. English lives on the bare paths here, so every
other URL is already unambiguous and stays a plain static asset — which keeps
the canonical English pages out of any redirect and keeps Function invocations
off the rest of the site. `_routes.json` pins that.

An explicit pick from the language switcher wins over the browser: the switcher
writes a `lang` cookie and the function prefers it, so choosing English on a
Chinese browser is not undone on the next visit to the homepage.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
2026-08-14 09:01:32 +08:00
..