Blog Agencies by market

Hreflang Tag Best Practices for Global Websites

Build a multilingual website that holds together across markets with stable locale URLs, correct hreflang, edge delivery, adaptable typography, and localized UX.

Guide 8 min read

If you’re building a site for several markets, treat each locale as a real experience, not a translated copy of the same page. The strongest architecture gives every language and region a stable URL, maps those URLs with hreflang, delivers assets close to the user, and lets layout, typography, dates, prices, and interaction patterns adapt to local expectations.

That work starts before translation. Internationalization, or i18n, removes the technical assumptions that make localization expensive later. Localization then adapts the product to a market’s language, conventions, and culture. The W3C definition of localization includes formats, currency, symbols, legal requirements, contact details, and script-specific readability, not just translated words.

Start with a locale model, not a language dropdown

The first architectural decision is the locale model: a stable combination of language, region, and sometimes script that controls content and behavior. For example, en-CA, en-US, fr-CA, and ar may share a brand system while serving different content, legal text, currency, and reading direction.

Write the model down before you create routes. For every locale, define:

  • The BCP 47 language tag used in HTML and application data.
  • The URL pattern, such as /en-ca/, a locale subdomain, or a country domain.
  • The fallback locale when content is missing.
  • Currency, number, date, time, address, and phone conventions.
  • The content owner and translation workflow.
  • Whether the market can change navigation, products, forms, or imagery.

Keep locale selection separate from automatic geolocation. A visitor in France may prefer English, a traveler may need a different market, and a search crawler should not be trapped in a redirect loop. Show a clear language and region selector, remember the choice, and let people change it later.

Use a predictable URL strategy. Subdirectories are simple to operate when one platform serves every market. Subdomains can separate deployments or teams. Country domains can send a strong regional signal but add domain and operational work. The choice matters less than consistency, stable canonical URLs, and a page model that can represent real market differences.

Make routing and `hreflang` agree

Routing decides what a visitor receives. hreflang tells search engines which equivalent page serves each language or region. They should be generated from the same locale map, not maintained as two unrelated lists.

Google Search Central documents three equivalent ways to declare alternate pages: HTML links, HTTP headers, and XML sitemaps. Choose one primary method that your team can keep complete. Adding all three does not create extra value and gives you three places to introduce drift.

Each localized page needs a complete, reciprocal set of alternates. That set includes the page itself, every supported alternate, and an x-default page when you have a language or market selector. Use fully qualified HTTPS URLs. If the Canadian English page points to the French Canadian page, the French Canadian page must point back.

Generate the links from content records rather than hand-writing them in templates. A simplified data shape might look like this:

{
  "contentKey": "home",
  "locales": {
    "en-CA": "https://example.com/en-ca/",
    "fr-CA": "https://example.com/fr-ca/",
    "en-US": "https://example.com/en-us/"
  },
  "fallback": "https://example.com/"
}

At build or publish time, validate that every URL returns the intended page, every page lists itself, and every reciprocal pair matches. A missing translation should not produce a false alternate. Mark the locale as unavailable or send the user to a documented fallback instead.

Separate shared design from local content

The best multilingual website architecture has a shared foundation and a market layer. The foundation contains tokens, components, accessibility behavior, performance budgets, analytics conventions, and content schemas. The market layer contains copy, products, offers, legal text, imagery, navigation labels, and journeys that differ by locale.

Do not force every market into one identical page tree. A shared component can support different content lengths and optional modules. A market can hide a product, add a local service, or change the order of proof without forking the entire front end.

Model translated fields as related content, not as copies pasted into one giant record. Each field needs a source status, translation status, reviewer, and publish state. This makes partial updates visible. It also prevents a new English claim from appearing on a French page before its supporting content is ready.

Keep string construction out of translation files. Concatenating fragments such as Hello, plus a name plus ! breaks word order, grammatical gender, and punctuation in many languages. Give translators complete messages with named variables, such as {firstName}, and let the locale decide the sentence.

Use Unicode throughout the stack and test names, addresses, search terms, and form input with accents and non-Latin scripts. The W3C internationalization guidance specifically calls out Unicode, bidirectional text, local formats, sorting, and separating localizable content from source code as parts of internationalization.

Deliver assets through a locale-aware edge layer

Dynamic CDN delivery should vary on the right inputs, not on every incidental request header. Define which assets are shared across locales and which vary by market. A product image may be shared, while a campaign image, legal badge, or text baked into an image may be local.

Use immutable, content-addressed assets for shared files. For localized files, include the locale or market in the asset key and cache policy. A request for /fr-ca/ should never receive an English image because a CDN cached the first response under a locale-blind key.

A practical delivery sequence is:

  1. Resolve the requested URL to a locale and content version.
  2. Render critical text and structural HTML at the edge or origin.
  3. Select responsive image variants from the locale’s asset manifest.
  4. Cache the result using the locale, content version, device-independent route, and relevant experiment key.
  5. Lazy-load below-the-fold media after the main content is usable.

Use cache keys deliberately. Do not vary the full response on Accept-Language when the URL already identifies the locale. That creates many cache variants and makes behavior hard to inspect. Use the header as a hint for first-visit selection, then redirect once to a stable URL only when you have a clear reason.

Performance needs field checks, not just a local laptop. web.dev’s performance guidance recommends measuring user-centered metrics, setting performance budgets, and checking resource delivery, images, fonts, and third-party code. Run those checks for every major locale and on representative mobile networks. A heavier script, font, or image in one market is still a real user experience problem.

Let typography and direction change the layout

Typography is part of localization because language changes geometry. German compounds can expand a button. French can add text to a heading. Arabic and Hebrew need right-to-left layout and a typeface that supports the required glyphs. CJK interfaces may need different line-breaking and font choices.

Build components that tolerate text growth. Test navigation, buttons, cards, tables, error messages, checkout steps, and consent dialogs with long translations. Avoid fixed heights around text. Let labels wrap, and reserve enough space for the longest supported string rather than the English source.

Set the document language with a valid BCP 47 tag. MDN’s lang reference notes that the attribute supports language identification and accessibility, including correct screen-reader pronunciation. Mark inline passages that switch language too.

Set text direction semantically. MDN’s dir reference defines ltr, rtl, and auto, and explains why the lang attribute alone does not set direction. Use logical CSS properties such as margin-inline-start, padding-inline, and inset-inline-end so the component can mirror without a second stylesheet.

Do not mirror everything automatically. A back arrow, media timeline, map, or brand mark may need a deliberate treatment. Test icons, numbers, punctuation, mixed-script names, and form validation messages inside both directions. Wrap unknown user text with dir="auto" or isolate it with bdi when appropriate.

Design localized journeys, not just localized screens

Localized UX changes the path a person takes through the site. Research the market before choosing imagery, examples, calls to action, payment methods, trust signals, and form fields. A translated headline cannot fix a journey that asks for the wrong identifier, uses an unfamiliar date format, or hides the regional service area.

Start with the task and its local constraints. A global brand may need different entry points for product discovery, support, recruitment, or purchase. Let the market layer change the order of those tasks while the shared system preserves interaction quality and accessibility.

Make language and region controls explicit. Label them in the current language, distinguish language from country when both matter, and show the destination before the switch. Never use flags as the only language labels. A flag represents a place, not a language, and one language can serve many countries.

Localize content governance as carefully as the interface. Assign owners for translation, legal review, SEO metadata, structured data, and campaign expiration. Add a release check that compares source and localized pages, flags missing fields, checks links, and confirms that analytics records the selected locale without exposing unnecessary personal data.

Test the system before every market launch

Launch testing should cover the whole path from URL to content, asset, interaction, and measurement. A page that looks correct in one language can fail when its translation is longer or its script flows in the opposite direction.

Use this release checklist:

Area Test Pass condition
URLs Open every locale route directly The right language, region, canonical, and fallback appear
Search Validate the alternate URL set Self-reference, reciprocity, valid codes, and absolute URLs are present
Content Compare required fields by locale No accidental source-language copy or stale legal text remains
Layout Test long strings and both directions No clipping, overlap, broken focus order, or unreadable controls
Assets Inspect CDN cache behavior Locale-specific media never crosses into another market
UX Complete key journeys Forms, errors, dates, currency, and local options make sense
Performance Measure representative devices and networks Each locale stays within its agreed performance budget
Operations Publish and roll back a translation Owners can see status, approve changes, and restore a prior version

Run automated tests against generated HTML and sitemap output. Add visual regression cases for long labels and RTL pages. Keep a small set of human review tasks for cultural tone, imagery, legal language, and whether the experience feels native rather than mechanically translated.

Sources & References

Frequently asked questions

What is the best architecture for a multilingual website?

Use stable locale-aware URLs backed by a shared component system and a market-specific content layer. Generate routing, canonical URLs, hreflang, metadata, and asset selection from one locale model. That gives each market room to differ without creating an unmaintainable fork of the whole site.

What is an `hreflang` tag used for?

An hreflang tag identifies the language or regional version of a page for search engines. Each version should list itself and its alternates with fully qualified URLs, and the alternate pages should reference one another. It does not replace translated content or determine a page’s language by itself. Keep the mapping beside the locale data that drives routing, so a new market cannot publish with only half of its alternate links.

Should a multilingual website use subdomains or subdirectories?

Either can work when URLs are stable, content is localized, and the alternate mapping is complete. Subdirectories simplify one-platform operations, while subdomains can separate deployments or teams. Country domains can fit strong regional operations, but they add domain management and maintenance work.

How do you handle RTL languages in web design?

Set lang and dir on the document, use logical CSS properties, and test the entire interface in an RTL locale. Check text expansion, icons, punctuation, numbers, forms, focus order, and mixed-direction content. Do not assume that every visual element should mirror. Include real user-generated text in the test set.

How can a CDN serve localized website assets correctly?

Put locale-specific assets in an explicit manifest and include the locale or content version in the cache key when the response varies. Keep shared assets immutable and shared. Test cold and warm cache requests for each market so an asset from one locale cannot appear in another.

What should you test before launching a localized site?

Test direct URLs, fallback behavior, reciprocal hreflang, canonical tags, translated fields, long strings, RTL layout, localized formats, forms, assets, analytics, and performance. Add human review for cultural references, imagery, legal text, and the tone of calls to action. Automated checks catch consistency errors, while people catch meaning and context.

Let's work together

Ready to take your brand to the next level? Tell us about your project.

Start a project