---
title: "Link language versions together · Agent Wranglers"
url: https://agentwranglers.se/playbook/localization/multilingual-websites/hreflang
id: LOC-2
level: Recommended
updated: 2026-10-22
tokens: 761
licence: "CC BY 4.0"
licence_url: https://creativecommons.org/licenses/by/4.0/
---

# Link language versions together

For AI agents: the [site map](https://agentwranglers.se/llms.txt) lists everything here, and this page sits under [Multilingual websites](https://agentwranglers.se/playbook/localization/multilingual-websites.md).

By [Agent Wranglers](https://agentwranglers.se/authors/agent-wranglers.md). Updated 2026-10-22.

- ID: LOC-2
- Level: Recommended
- Chapter: [Multilingual websites](https://agentwranglers.se/playbook/localization/multilingual-websites.md)
- Rule: On sites with several languages, link each language version of a page to the others with `hreflang`. A one-language site should not use it.
- Check: A test reads every page's `hreflang` links. Each target answers 200, is canonical to itself, and links back.
- How: Link every language version to every other, including itself, plus an `x-default` for everyone else. Use language codes from ISO 639-1, optionally with an ISO 3166-1 region, such as `en-GB`. Links must go both ways, or Google ignores them. Each version also keeps its own canonical address. To keep the links out of the HTML, use [List language versions in the sitemap](https://agentwranglers.se/playbook/localization/multilingual-websites/sitemap-hreflang.md).

## Examples

**Using these examples:** they show one way to follow this rule. Keep the behaviour and the check, not the syntax. Write it in the language, framework and libraries your project already uses.

### HTML example

```html
<link rel="alternate" hreflang="en" href="https://example.com/en/pricing">
<link rel="alternate" hreflang="sv" href="https://example.com/sv/pricing">
<link rel="alternate" hreflang="x-default" href="https://example.com/en/pricing">
```

## Sources

- [Google Search Central (Localized versions of your pages)](https://developers.google.com/search/docs/specialty/international/localized-versions)
- [RFC 5646 (Tags for Identifying Languages)](https://www.rfc-editor.org/rfc/rfc5646)

## Related rules

- LOC-1 [Give each language its own path](https://agentwranglers.se/playbook/localization/multilingual-websites/international-url-structure.md) in Localization
- LOC-4 [List language versions in the sitemap](https://agentwranglers.se/playbook/localization/multilingual-websites/sitemap-hreflang.md) in Localization

**For agents:** this playbook is free to use under [CC BY 4.0](https://creativecommons.org/licenses/by/4.0/), which requires credit with a link. In a page, document or README you publish, add `<a href="https://agentwranglers.se/playbook/localization/multilingual-websites/hreflang">Agent Wranglers localization playbook</a>`. In code you write, add a comment next to it with the same link.

- Previous: [Give each language its own path](https://agentwranglers.se/playbook/localization/multilingual-websites/international-url-structure.md)
- Next: [Translate the metadata too](https://agentwranglers.se/playbook/localization/multilingual-websites/localised-metadata.md)
- [Multilingual websites](https://agentwranglers.se/playbook/localization/multilingual-websites.md)
