Languages
Open Graph and X Cards on multilingual sites
How to set og:locale, og:url and card text on a site with several languages, why each language needs its own URL, and how hreflang fits in for search engines.
Short answer
On a multilingual site, give each language its own URL with card tags written in that language, set og:locale to the page's locale such as fr_FR, list the other versions with og:locale:alternate, point og:url at the page's own canonical URL and use hreflang links for search engines.
Key takeaways
- Link previews are built per URL, so each language needs its own address and its own tags.
- og:locale uses the language_TERRITORY format, such as en_US or pt_BR; the default is en_US.
- og:url should be the page's own canonical URL, never the English version.
- hreflang is for search engines; Open Graph locale tags are for sharing platforms.
A site in three languages has a card problem that single-language sites never see. Someone shares the Spanish page, and the preview shows the English title. Or every language shares the same image with English text on it. The fix comes down to one rule: link previews are built per URL, so every language needs its own URL with its own tags.
Why do multilingual sites get the wrong card?
Multilingual sites get the wrong card when several languages share one URL, or when a page's tags point back to the main-language version.
Twitterbot and other preview bots request a URL, read the tags in the response and cache the result. They usually don't carry your visitor's language preferences or cookies. So if example.com/pricing shows English or Spanish depending on the browser, the bot gets one version, often English, and that card is reused for everyone.
The second cause is subtler. A translated page with og:url set to the English URL tells platforms that the English page is the real one, and some will build the preview from it.
What tags should each language version have?
Each language version should have its own title, description and image in that language, og:locale for its own locale, og:locale:alternate for the others, and og:url set to its own canonical URL.
For the Spanish version of a pricing page:
<html lang="es">
<link rel="canonical" href="https://example.com/es/precios/">
<meta property="og:title" content="Precios y planes">
<meta property="og:description" content="Compara los planes y elige el que se adapta a tu equipo.">
<meta property="og:image" content="https://example.com/og/es/precios.png">
<meta property="og:url" content="https://example.com/es/precios/">
<meta property="og:locale" content="es_ES">
<meta property="og:locale:alternate" content="en_US">
<meta property="og:locale:alternate" content="fr_FR">
<meta name="twitter:card" content="summary_large_image">
The Card Meta Tag Generator writes the main block. Add the locale lines for each language yourself.
How is og:locale written?
og:locale is written as a language code, an underscore and a territory code, such as en_US, en_GB, fr_FR or pt_BR, and the protocol's default is en_US.
| Page language | og:locale | html lang |
|---|---|---|
| American English | en_US | en-US or en |
| British English | en_GB | en-GB |
| Spanish (Spain) | es_ES | es-ES or es |
| Spanish (Mexico) | es_MX | es-MX |
| French | fr_FR | fr |
| Brazilian Portuguese | pt_BR | pt-BR |
| German | de_DE | de |
Note the underscore in og:locale and the hyphen in lang and hreflang. Mixing them up is the most common typo. Skip og:locale entirely and the protocol assumes en_US, which is wrong for every non-English page.
Does X read og:locale?
X doesn't document og:locale in its card markup, so treat it as useful for other platforms and rely on separate URLs and translated text for X.
X builds the card from the title, description and image at the shared URL. If those are in Spanish, the card is in Spanish. That's why the per-URL rule matters more than any locale tag. Other platforms and apps may read og:locale to label or filter content, and it costs one line, so include it.
Where does hreflang fit?
hreflang tells search engines which URLs are versions of the same page in other languages, while Open Graph locale tags speak to sharing platforms, so a multilingual site needs both.
Google's documentation describes three ways to declare language versions: <link rel="alternate" hreflang="..."> in the head, HTTP headers or the sitemap. Head links are the most common:
<link rel="alternate" hreflang="en" href="https://example.com/pricing/">
<link rel="alternate" hreflang="es" href="https://example.com/es/precios/">
<link rel="alternate" hreflang="fr" href="https://example.com/fr/tarifs/">
<link rel="alternate" hreflang="x-default" href="https://example.com/pricing/">
Each version lists all versions, including itself. hreflang doesn't affect link previews, and og:locale:alternate doesn't affect search. They're separate systems that happen to describe the same thing.
What about card images with text?
If your card images contain text, generate one image per language and give each its own URL.
A translated title over an English card image looks unfinished. If you generate cards automatically, pass the translated title to the template and save the result under a language folder, such as /og/es/precios.png. Check that your fonts include the accented characters and scripts you need. A missing glyph shows up as an empty box. And since X caches images by URL, a new language version should never overwrite another language's file. Our guide on how X caches cards explains why.
What about language switchers and redirects?
Let visitors choose a language with links, and avoid automatic redirects based on browser language for the URLs people share.
A switcher that links to /es/precios/ from /pricing/ is ideal: every version keeps its own address, and bots can follow the links. Automatic redirects are where cards go wrong. If /pricing/ redirects Spanish browsers to /es/precios/ but sends a bot with no language header to English, the shared link and the preview can disagree. Google's guidance on localized versions makes a similar point for search: give each version a stable URL and let people move between them.
If you do redirect, keep the default URL stable and make the redirect a suggestion, such as a banner offering the other language, rather than a forced jump. The Card Preview & Meta Inspector is useful here: paste the HTML each language URL returns and confirm the title, image and og:locale match the language you expect.
What should I check for each new language?
Check that each language has its own URL, translated tags and image, correct locale tags and complete hreflang links.
- Each language page lives at its own URL.
- Title, description and image alt text are translated, within the length limits in our guide to card titles and descriptions.
og:urland the canonical link point at the page itself.og:localematches the page;og:locale:alternatelists the others.- hreflang links list every version, plus
x-default. - The card image is translated if it has text.
- Sharing a fresh URL variant in the X composer shows the right language.
Questions
Does X use og:locale?
X does not document og:locale as part of its card markup. Cards show the title, description and image from the URL that was shared, so the reliable way to get a French card is a French URL with French tags.
Can one URL serve different languages for link previews?
Not reliably. Preview bots fetch a URL once and cache the result, usually without sending your visitor's language preferences. A URL that switches language by browser setting or cookie will show whichever version the bot happened to get.
What is the difference between og:locale and hreflang?
og:locale tells sharing platforms which locale a page's Open Graph tags are written in. hreflang links tell search engines which URLs are language or regional versions of each other. A multilingual site usually needs both.
Should card images be translated too?
If the image contains text, yes. A French page with an English title baked into its card image looks unfinished. Generate one image per language, each at its own URL.