This website: 45% less JavaScript, two indexable languages
The problem
The previous version looked fine and scored badly. Every section was a client component, so visitors downloaded an animation library, an i18n library and both languages' texts before anything could move. Much of the page started at opacity: 0 and stayed invisible until scripts ran. Persian existed only in browser memory: no URL, nothing for search engines, and the choice was lost on reload.
Decisions
Two real languages. English lives at the root and Persian under /fa/, each with its own root layout, so lang, dir and hreflang are right in the HTML. The translation library is gone: dictionaries are read while the pages are built, and a missing key is a type error.
CSS instead of an animation library. Reveals use scroll-driven animations (animation-timeline: view()). Where those aren't supported, the content is simply there. One delegated listener drives every pointer glow.
Islands only where there is state. The header, search, contact form, blog filter and table of contents are client components. The command menu and the upload demo load on first use.
Fonts that can't shift the layout. The framework's font loader made each page preload both languages' fonts, about 110 KB. The fonts are now self-hosted and each page preloads only its own. My first fix dropped preloading altogether; Lighthouse in CI failed it, because text moved when the font arrived on machines without a matching fallback. font-display: optional rules that out.
Checks in CI. Every deploy has to pass type checks, a JavaScript budget, Playwright tests, axe in light and dark themes, link and metadata checks, and Lighthouse.
Result
| Homepage | Before | After |
|---|---|---|
| JavaScript, gzipped | 282 KB | 155 KB |
| Lighthouse performance, mobile | 67–72 | 79–93 |
| Lighthouse accessibility | 96 | 100 |
| Largest Contentful Paint, simulated | 4.2–4.3 s | 1.7–2.7 s |
| Total Blocking Time | 400–680 ms | 280–700 ms |
Lighthouse mobile runs from one machine in November 2026, both versions on GitHub Pages: three runs before, eight after. Content appears in about half the time. Blocking time did not clearly improve: what remains is React hydration and the first layout of a long page, which is the next thing to work on.