# International SEO hreflang tags implemented correctly

- **Pattern:** `ab-002491` (`seo-advanced.crawlability.hreflang-implementation`)
- **Severity:** info
- **Lifecycle:** active
- **Last modified:** 2026-04-18
- **Canonical URL:** https://auditbuffet.com/patterns/ab-002491
- **License:** CC-BY-4.0 — attribute to AuditBuffet Pattern Catalog (https://auditbuffet.com/patterns/ab-002491)

## Why it matters

Missing or misconfigured `hreflang` annotations cause Google to serve the wrong language version to users — French visitors land on English pages, bounce rates spike, and both versions compete for the same queries. Missing `x-default` means users from unlisted regions get an arbitrary variant instead of your canonical fallback, which degrades conversion on international traffic that you're already spending to acquire.

## Severity rationale

Info because hreflang errors only affect multi-locale sites and fall back to language-guessed serving.

## Remediation

Declare every locale variant plus `x-default` on every page that has translations. Implement in `app/[locale]/layout.tsx`:

```tsx
export async function generateMetadata({ params }) {
  return {
    alternates: {
      canonical: `https://yoursite.com/${params.locale}`,
      languages: { en: '/en', fr: '/fr', 'x-default': '/en' }
    }
  }
}
```

## Detection

- **ID:** `hreflang-implementation`
- **Severity:** `info`
- **What to look for:** Count all language or region variants served by the site (e.g., `/en/`, `/fr/`, `/de/` routes or locale subdomains). For each page with language variants, check for `<link rel="alternate" hreflang="...">` tags or hreflang attributes in the XML sitemap. Verify `x-default` is specified for the default language version. Enumerate the hreflang tags found per page.
- **Pass criteria:** For multilingual/multi-regional sites, at least 90% of pages with language variants include hreflang tags listing all available languages, plus an `x-default` tag for the default version. Report: "X language variants detected; Y of Z pages have complete hreflang tags."
- **Fail criteria:** Fewer than 90% of multilingual pages have hreflang tags, or `x-default` is missing from any page with hreflang tags.
- **Skip (N/A) when:** Site serves only 1 language and 1 geographic region (no locale routes, no language subdomains).
- **Detail on fail:** `"Site has /en and /fr versions; 5 of 12 pages lack hreflang tags"` or `"hreflang tags present on all pages but x-default not specified on 3 pages"`.
- **Remediation:** Add hreflang tags to multilingual pages in `app/[locale]/layout.tsx`:

  ```tsx
  export const metadata = {
    alternates: {
      languages: {
        en: 'https://yoursite.com/en/page',
        fr: 'https://yoursite.com/fr/page',
        'x-default': 'https://yoursite.com/page',
      },
    },
  }
  ```

Taxons: findability

HTML version: https://auditbuffet.com/patterns/ab-002491
