---
name: hreflang-audit
description: "Audits hreflang on a multilingual or multi-region site: valid language and region codes, self-references, return links between every version, x-default, targets that are live, indexable and self-canonical, agreement between HTML, HTTP headers and XML sitemaps, and redirects by location or browser language that hide versions from Google. Samples one page in all its languages per template, builds a return-link matrix, gives a verdict and writes corrected tags ready to paste. Use when someone asks to check hreflang, says the wrong language or country version ranks, is launching a new language or region, or asks for an international SEO check."
license: MIT
compatibility: "Any AI agent that can fetch pages and sitemaps. Raw HTML and response headers are needed, since many fetch tools drop <link> tags from the head; curl or a raw fetch works. Search Console data by country is optional and confirms which version ranks where."
metadata:
  title: "Hreflang audit"
  category: "SEO: technical"
  requires: "none"
  data-needed: "None"
  slate-tools: "web_research, query_pages (Slate MCP); Web research and Search Console page data in the Slate app"
  slate-signup: "https://app.slatehq.ai/register"
  homepage: "https://slatehq.com/skills/hreflang-audit"
  author: "Slate"
  version: "1.0.0"
---

# Hreflang audit

Checks that every language and region version of a page names all the others, that each one names it back, that the codes are valid, and that every URL in the set is live, indexable and its own canonical. It works on clusters (one page in all its languages) sampled per template, because hreflang is generated by templates and breaks the same way across thousands of pages, and it reads all three places hreflang can live (HTML head, HTTP headers, sitemaps), since two sources that disagree are a bug in themselves. The result is a verdict, a matrix showing exactly which links are missing, and corrected tags. In [Slate](https://slatehq.com) it can also run Google searches from each target country, to show which version actually ranks there.

## When to use

- "Check our hreflang", "the US page ranks in the UK", "Google shows our English page to Spanish searchers", "we launched French and German versions", "is our international setup right", "hreflang errors in our crawler".
- After adding a language or region, after a CMS or translation-plugin change, or when Search Console shows the wrong pages getting impressions in a country.
- Not for choosing markets or researching keywords per country: use `international-keyword-research`.
- Not for translating or adapting copy: use `transcreation`.
- Not for how AI engines answer in other languages: use `multilingual-ai-visibility`.
- Not for the wider technical layer: use `technical-seo-audit`.

## What you need

Required:
- **The domain** and **the versions**: each language or language-region (for example `en`, `en-GB`, `fr`, `de-AT`) and how it is served (folders like `/fr/`, subdomains, separate country domains, or parameters).

Ask for, or assume and state:
- **Where hreflang is declared**: HTML head, HTTP `Link` headers (common for PDFs), XML sitemaps, or several. Default: find out in step 3.
- **Intended x-default**: the page for everyone else, often the English version or a language selector. Optional.
- **Key pages**: the homepage, pricing, top product or feature pages and the top articles in each language.
- **Automatic redirects**: does the site redirect by IP location or browser language?
- **Optional**: Search Console Performance data filtered by country and page.

## Data and tools

- **In Slate:** Web research reads pages and lists sitemap URLs per language; it also runs Google searches from a chosen country, which shows the version that ranks there; Search Console data on the Pages screen shows which language URLs earn clicks.
- **With the Slate MCP server:** `web_research` with `action: "scrape"` for each URL (text extraction may drop `<link>` tags; check one page, and if the alternates are missing, read the raw head another way before concluding they're absent); `web_research` with `action: "sitemap"` and `include_string: "/fr/"` to list one language's URLs (the sitemap's `xhtml:link` alternates need the raw XML); `web_research` with `action: "google_search"`, a brand or product query and `locale` set to each target country; `query_pages` with `view: "list"` and `search: "/fr/"` to see each language's tracked pages and clicks.
- **Without Slate:** `curl -sL` for raw HTML, `curl -sI` for `Link` headers, the raw sitemap XML, and Search Console's Performance report filtered by country (Pages tab) to see which version gets impressions where. Search Console no longer has an hreflang error report, so the audit is the check.

## Procedure

1. **Map the setup.** List versions, URL pattern per version, declaration method(s), x-default and any automatic redirects.
2. **Pick clusters.** One cluster is one page in every language. Take 2 or 3 clusters per template (home, product or feature, article, pricing, category) plus the top-traffic pages. If hreflang lives in sitemaps, also check the whole sitemap mechanically.
3. **Collect every annotation.** For each URL in each cluster, record hreflang from the HTML head (raw and rendered), the HTTP `Link` header and the sitemap. Two sources that list different URLs or codes are a finding.
4. **Validate codes.** Language in ISO 639-1 (`en`, `ja`, `zh`), optionally a region in ISO 3166-1 alpha-2 (`en-GB`, `pt-BR`) or a script (`zh-Hant`). Codes aren't case-sensitive but must be real: see `references/hreflang-rules.md` for the common errors.
5. **Build the return-link matrix.** For each page: does it reference itself, does it list every other version, and does every listed page link back? Google ignores a pair that isn't confirmed in both directions; the other confirmed pairs still work.
6. **Check every target.** Each URL in a set must be absolute (protocol and host), return 200 without redirecting, be indexable (no noindex, not blocked by robots.txt) and be its own canonical. One code must not point to two URLs in the same set.
7. **Check canonicals.** Each language version is canonical to itself. A canonical from `/fr/page` to `/page` tells Google to drop the French page and voids its hreflang.
8. **Check automatic redirects.** Redirects by IP or browser language can stop Googlebot (which mostly crawls without a language preference, from the US) from ever seeing some versions. Recommend a suggestion banner instead, with x-default on the selector or default page.
9. **Check language match.** The page's actual content and `<html lang>` should match its hreflang code. Google detects language from the content; Bing gives more weight to declared language signals.
10. **Confirm in results** (optional). Search from each target country, or filter Search Console by country: is the right version shown? Note mismatches by template.
11. **Rate and write fixes.** Use the severity table and verdict rules in the reference. Write the corrected tag set per template, and say where to generate it (from the CMS's translation links, never typed by hand per page).

## Output

```markdown
## Hreflang audit: <domain>, <date>
Verdict: <PASS / NEEDS FIXES / BROKEN>. Versions: <list>. Declared in: <HTML / headers / sitemaps>. Sampled: <n> clusters across <n> templates.

### Return-link matrix: <template>, <cluster>
| Page | Self-ref | Lists all versions | Return links OK | Code valid | 200, indexable | Self-canonical |
|---|---|---|---|---|---|---|
| /page | yes | no (missing de) | yes | yes | yes | yes |

### Findings
| Severity | Issue | Template | Example URLs | Evidence | Fix |

### Corrected tags (per template)
<link rel="alternate" hreflang="en" href="https://example.com/page" />
<link rel="alternate" hreflang="fr" href="https://example.com/fr/page" />
<link rel="alternate" hreflang="x-default" href="https://example.com/page" />

### Results check (optional)
| Country | Query | Version shown | Expected |
```

## Quality checks

- Annotations were read from raw HTML or headers; "no hreflang found" was verified, not assumed from a text conversion.
- Every cluster covers all versions of its page, and every template has at least two clusters.
- Every target URL's status, indexability and canonical were checked, not only the tags.
- Each finding gives the exact bad value and the corrected value.
- The verdict follows the written rules.
- A single-language site with no hreflang is a pass, not a finding.

## Common mistakes

- **Invented codes.** `en-UK`, `jp`, `es-LA` and `en_US` aren't valid; use `en-GB`, `ja`, country codes or plain `es`, and hyphens.
- **Canonical to the main language.** It removes the other versions; each version is canonical to itself.
- **Missing return links.** A tag on the English page alone does nothing for the French one.
- **Pointing at redirects or noindexed pages.** The pair is ignored.
- **Treating x-default as required.** It is optional; use it for a selector or a sensible default.
- **Forcing visitors by IP.** Crawlers and travellers get the wrong version; offer, don't force.

## Related skills

- `international-keyword-research`: what people search for in each market.
- `transcreation`: adapt the content each version carries.
- `multilingual-ai-visibility`: how AI engines answer in each language.
- `site-migration-seo-plan`: remap hreflang when URLs change.
- `technical-seo-audit`: the rest of the technical layer.
