How to build a multilingual static website
A practical architecture for indexable language-specific HTML, hreflang and RTL interfaces.
Use independent URLs
Give each translated document its own stable URL. Serve the actual language in the first HTML response, rather than requiring a crawler to change local storage or execute a language switcher. Each URL should have a self-referencing canonical and reciprocal hreflang references to equivalent pages.
Keep language navigation crawlable
Use real links for language alternatives and preserve the path and fragment when navigating. Set the HTML lang and dir attributes before rendering; load local fonts for RTL languages. Do not forcibly redirect readers based on their browser language.
Test the output without JavaScript
Check the response status, document title, main text, hreflang and internal links with scripts disabled. Then test the interactive language switch, dark mode and responsive layout in a browser.
Implementation in this portfolio
The localized documents are generated from shared templates and a translation dictionary. The runtime uses the current URL to choose language, while the theme remains stored locally. The sitemap contains only indexable pages.