Hreflang & International SEO

VerifiedCaution

Audit, validate, and generate hreflang tags for multilingual/multiregional sites. Detects common mistakes, validates language/region codes, and ensures proper implementation.

Sby Skills Guide Bot
ContentIntermediate
8/29/2026
Claude CodeCursorWindsurfCodex
#seo#hreflang#international-seo#i18n#validation

Recommended for

Automated summary

This skill audits, validates, and generates hreflang tags for multilingual and multiregional sites, whether the implementation lives in HTML, HTTP headers, or XML sitemaps.

Strengths

  • A precise checklist: self-referencing tags, return tags, x-default, canonical alignment, and protocol consistency
  • Catches the most frequent language and region code mistakes (eng for en, en-uk for en-GB, zh without a script qualifier)
  • A severity-ranked table of common mistakes that maps directly onto a fix priority order
  • Also covers cross-domain setups, with sitemap-based implementation recommended there

Limitations

  • Describes the rules but not the exact commands, so the agent still has to crawl or read the files itself
  • Says nothing about the server-side plumbing (language negotiation, redirects) or about performance
  • Ignores other international SEO concerns such as currency, pricing, and duplicate content
When to use it

Reach for it when a site targets several languages or countries and you need to check or produce a correct hreflang set.

When not to use it

Skip it for a single-language site, or when the issue is general SEO rather than locale alternates.

Security analysis

Caution
Quality score90/100

The skill is an SEO audit and generation guide and does not contain harmful commands. However, its allowed tools include Bash and WebFetch, which can execute commands and fetch remote content. If combined with untrusted input or misused, these could pose risk, so caution is appropriate.

Findings
  • •Declares Bash and WebFetch as allowed tools, enabling arbitrary command execution and network requests; no destructive or exfiltration instructions observed, but these capabilities warrant caution.
How this analysis is made

Examples

Audit an existing set
Audit the hreflang tags on https://example.com/fr/ and its alternates — check self-referencing tags, return tags, x-default, and canonical alignment, then list the issues by severity.
Generate tags from scratch
Generate hreflang tags for a site with English, French, and German versions served from subdirectories (/en/, /fr/, /de/) on the same domain, with x-default pointing to the language selector page.
Validate codes in a sitemap
Read my sitemap.xml and flag every invalid hreflang language or region code, plus any URL that mixes HTTP and HTTPS.

name: seo-hreflang description: > Hreflang and international SEO audit, validation, and generation. Detects common mistakes, validates language/region codes, and generates correct hreflang implementations. Use when user says "hreflang", "i18n SEO", "international SEO", "multi-language", "multi-region", or "language tags". risk: unknown source: "https://github.com/AgriciDaniel/claude-seo" date_added: "2026-03-21" user-invokable: true argument-hint: "[url]" allowed-tools:

  • Read
  • Grep
  • Glob
  • Bash
  • WebFetch

Hreflang & International SEO

When to Use

  • Use when validating or generating hreflang for multilingual or multiregional sites.
  • Use when the user mentions international SEO, language tags, x-default, or hreflang issues.
  • Use when auditing locale alternates across HTML, headers, or sitemap implementations.

Validate existing hreflang implementations or generate correct hreflang tags for multi-language and multi-region sites. Supports HTML, HTTP header, and XML sitemap implementations.

Validation Checks

1. Self-Referencing Tags

  • Every page must include an hreflang tag pointing to itself
  • The self-referencing URL must exactly match the page's canonical URL
  • Missing self-referencing tags cause Google to ignore the entire hreflang set

2. Return Tags

  • If page A links to page B with hreflang, page B must link back to page A
  • Every hreflang relationship must be bidirectional (A→B and B→A)
  • Missing return tags invalidate the hreflang signal for both pages
  • Check all language versions reference each other (full mesh)

3. x-default Tag

  • Required: designates the fallback page for unmatched languages/regions
  • Typically points to the language selector page or English version
  • Only one x-default per set of alternates
  • Must also have return tags from all other language versions

4. Language Code Validation

  • Must use ISO 639-1 two-letter codes (e.g., en, fr, de, ja)
  • Common errors:
    • eng instead of en (ISO 639-2, not valid for hreflang)
    • jp instead of ja (incorrect code for Japanese)
    • zh without region qualifier (ambiguous; use zh-Hans or zh-Hant)

5. Region Code Validation

  • Optional region qualifier uses ISO 3166-1 Alpha-2 (e.g., en-US, en-GB, pt-BR)
  • Format: language-REGION (lowercase language, uppercase region)
  • Common errors:
    • en-uk instead of en-GB (UK is not a valid ISO 3166-1 code)
    • es-LA (Latin America is not a country; use specific countries)
    • Region without language prefix

6. Canonical URL Alignment

  • Hreflang tags must only appear on canonical URLs
  • If a page has rel=canonical pointing elsewhere, hreflang on that page is ignored
  • The canonical URL and hreflang URL must match exactly (including trailing slashes)
  • Non-canonical pages should not be in any hreflang set

7. Protocol Consistency

  • All URLs in an hreflang set must use the same protocol (HTTPS or HTTP)
  • Mixed HTTP/HTTPS in hreflang sets causes validation failures
  • After HTTPS migration, update all hreflang tags to HTTPS

8. Cross-Domain Support

  • Hreflang works across different domains (e.g., example.com and example.de)
  • Cross-domain hreflang requires return tags on both domains
  • Verify both domains are verified in Google Search Console
  • Sitemap-based implementation recommended for cross-domain setups

Common Mistakes

| Issue | Severity | Fix | |-------|----------|-----| | Missing self-referencing tag | Critical | Add hreflang pointing to same page URL | | Missing return tags (A→B but no B→A) | Critical | Add matching return tags on all alternates | | Missing x-default | High | Add x-default pointing to fallback/selector page | | Invalid language code (e.g., eng) | High | Use ISO 639-1 two-letter codes | | Invalid region code (e.g., en-uk) | High | Use ISO 3166-1 Alpha-2 codes | | Hreflang on non-canonical URL | High | Move hreflang to canonical URL only | | HTTP/HTTPS mismatch in URLs | Medium | Standardize all URLs to HTTPS | | Trailing slash inconsistency | Medium | Match canonical URL format exactly | | Hreflang in both HTML and sitemap | Low | Choose one method (sitemap preferred for large sites) | | Language without region when needed | Low | Add region qualifier for geo-targeted content |

Implementation Methods

Method 1: HTML Link Tags

Best for: Sites with <50 language/region variants per page.

<link rel="alternate" hreflang="en-US" href="https://example.com/page" />
<link rel="alternate" hreflang="en-GB" href="https://example.co.uk/page" />
<link rel="alternate" hreflang="fr" href="https://example.com/fr/page" />
<link rel="alternate" hreflang="x-default" href="https://example.com/page" />

Place in <head> section. Every page must include all alternates including itself.

Method 2: HTTP Headers

Best for: Non-HTML files (PDFs, documents).

Link: <https://example.com/page>; rel="alternate"; hreflang="en-US",
      <https://example.com/fr/page>; rel="alternate"; hreflang="fr",
      <https://example.com/page>; rel="alternate"; hreflang="x-default"

Set via server configuration or CDN rules.

Method 3: XML Sitemap (Recommended for large sites)

Best for: Sites with many language variants, cross-domain setups, or 50+ pages.

See Hreflang Sitemap Generation section below.

Method Comparison

| Method | Best For | Pros | Cons | |--------|----------|------|------| | HTML link tags | Small sites (<50 variants) | Easy to implement, visible in source | Bloats <head>, hard to maintain at scale | | HTTP headers | Non-HTML files | Works for PDFs, images | Complex server config, not visible in HTML | | XML sitemap | Large sites, cross-domain | Scalable, centralized management | Not visible on page, requires sitemap maintenance |

Hreflang Generation

Process

  1. Detect languages: Scan site for language indicators (URL path, subdomain, TLD, HTML lang attribute)
  2. Map page equivalents: Match corresponding pages across languages/regions
  3. Validate language codes: Verify all codes against ISO 639-1 and ISO 3166-1
  4. Generate tags: Create hreflang tags for each page including self-referencing
  5. Verify return tags: Confirm all relationships are bidirectional
  6. Add x-default: Set fallback for each page set
  7. Output: Generate implementation code (HTML, HTTP headers, or sitemap XML)

Hreflang Sitemap Generation

Sitemap with Hreflang

<?xml version="1.0" encoding="UTF-8"?>
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"
        xmlns:xhtml="http://www.w3.org/1999/xhtml">
  <url>
    <loc>https://example.com/page</loc>
    <xhtml:link rel="alternate" hreflang="en-US" href="https://example.com/page" />
    <xhtml:link rel="alternate" hreflang="fr" href="https://example.com/fr/page" />
    <xhtml:link rel="alternate" hreflang="de" href="https://example.de/page" />
    <xhtml:link rel="alternate" hreflang="x-default" href="https://example.com/page" />
  </url>
  <url>
    <loc>https://example.com/fr/page</loc>
    <xhtml:link rel="alternate" hreflang="en-US" href="https://example.com/page" />
    <xhtml:link rel="alternate" hreflang="fr" href="https://example.com/fr/page" />
    <xhtml:link rel="alternate" hreflang="de" href="https://example.de/page" />
    <xhtml:link rel="alternate" hreflang="x-default" href="https://example.com/page" />
  </url>
</urlset>

Key rules:

  • Include the xmlns:xhtml namespace declaration
  • Every <url> entry must include ALL language alternates (including itself)
  • Each alternate must appear as a separate <url> entry with its own full set
  • Split at 50,000 URLs per sitemap file

Output

Hreflang Validation Report

Summary

  • Total pages scanned: XX
  • Language variants detected: XX
  • Issues found: XX (Critical: X, High: X, Medium: X, Low: X)

Validation Results

| Language | URL | Self-Ref | Return Tags | x-default | Status | |----------|-----|----------|-------------|-----------|--------| | en-US | https://... | ✅ | ✅ | ✅ | ✅ | | fr | https://... | ❌ | ⚠️ | ✅ | ❌ | | de | https://... | ✅ | ❌ | ✅ | ❌ |

Generated Hreflang Tags

  • HTML <link> tags (if HTML method chosen)
  • HTTP header values (if header method chosen)
  • hreflang-sitemap.xml (if sitemap method chosen)

Recommendations

  • Missing implementations to add
  • Incorrect codes to fix
  • Method migration suggestions (e.g., HTML to sitemap for scale)

Error Handling

| Scenario | Action | |----------|--------| | URL unreachable (DNS failure, connection refused) | Report the error clearly. Do not guess site structure. Suggest the user verify the URL and try again. | | No hreflang tags found | Report the absence. Check for other internationalization signals (subdirectories, subdomains, ccTLDs) and recommend the appropriate hreflang implementation method. | | Invalid language/region codes detected | List each invalid code with the correct replacement. Provide a corrected hreflang tag set ready to implement. |

Limitations

  • Use this skill only when the task clearly matches the scope described above.
  • Do not treat the output as a substitute for environment-specific validation, testing, or expert review.
  • Stop and ask for clarification if required inputs, permissions, safety boundaries, or success criteria are missing.

From the file to a first result

The download contains exactly the content displayed on this page. This copy may differ from the latest version in the source repository.

View the source and supporting files

This download contains SKILL.md only. Any scripts, references, templates and dependencies are not included. Get the required files from the source, preserving their directory structure, before continuing.

1. Download the file

Download SKILL.md

From the root of a test project, save the file as .skill-downloads/hreflang-international-seo-mte1ligs/SKILL.md, or use the command below. This folder is for inspecting the skill before installation.

Command for macOS/Linux or WSL: requires a POSIX shell and curl. On Windows without WSL, use the download button and create the folder manually.

mkdir -p '.skill-downloads/hreflang-international-seo-mte1ligs' && curl --fail --show-error --location 'https://skills-guides.com/api/skills/hreflang-international-seo-mte1ligs/download' --output '.skill-downloads/hreflang-international-seo-mte1ligs/SKILL.md.part' && mv '.skill-downloads/hreflang-international-seo-mte1ligs/SKILL.md.part' '.skill-downloads/hreflang-international-seo-mte1ligs/SKILL.md'

2. Check prerequisites

Read SKILL.md before using it. If it references scripts or external services, inspect them and prepare the required access in your test environment.

No recognized prerequisites section in this file. This does not mean it is self-contained: libraries, tools and access requirements may be mentioned elsewhere in the content or source repository.

The platforms on this page are catalog indications. The paths below follow tool documentation; they do not prove this skill has been run in those tools. No minimum tool version is confirmed for this listing.

3. Load the skill

After inspection, copy the complete folder into your project using one of the commands below, then open a new tool session. The command stops if a folder with the same name already exists: compare the files before replacing it.

Claude Code
test -f '.skill-downloads/hreflang-international-seo-mte1ligs/SKILL.md' && test -s '.skill-downloads/hreflang-international-seo-mte1ligs/SKILL.md' && mkdir -p '.claude/skills' && test ! -e '.claude/skills/seo-hreflang' && cp -R '.skill-downloads/hreflang-international-seo-mte1ligs' '.claude/skills/seo-hreflang'

Cursor
test -f '.skill-downloads/hreflang-international-seo-mte1ligs/SKILL.md' && test -s '.skill-downloads/hreflang-international-seo-mte1ligs/SKILL.md' && mkdir -p '.cursor/skills' && test ! -e '.cursor/skills/seo-hreflang' && cp -R '.skill-downloads/hreflang-international-seo-mte1ligs' '.cursor/skills/seo-hreflang'

Codex
test -f '.skill-downloads/hreflang-international-seo-mte1ligs/SKILL.md' && test -s '.skill-downloads/hreflang-international-seo-mte1ligs/SKILL.md' && mkdir -p '.agents/skills' && test ! -e '.agents/skills/seo-hreflang' && cp -R '.skill-downloads/hreflang-international-seo-mte1ligs' '.agents/skills/seo-hreflang'

OpenSkills

OpenSkills must already be installed. The local install/read procedure is checked with OpenSkills 1.5.0, which requires Node.js ≥ 20.6.0. Catalog slugs are not resolved automatically.

Official OpenSkills installation
openskills install './.skill-downloads/hreflang-international-seo-mte1ligs'

openskills read 'hreflang-international-seo-mte1ligs'

Reading should display the installed file content and its base directory. It does not run the skill or install its dependencies.

For an agent that reads AGENTS.md, then sync the index. This command changes AGENTS.md: review the diff before using it.

openskills sync

Manual method or another tool: attach SKILL.md to a conversation, or open it in an agent that can read files. Include any required supporting resources. No universal folder is recognized by every tool.

4. Try a first task

Use a short, synthetic input: an API endpoint, a small document or an interface brief. In a new conversation, attach the file or give the agent its path, then adapt this request:

Read .skill-downloads/hreflang-international-seo-mte1ligs/SKILL.md and apply its instructions to this example: [describe a test input]. Identify any missing files, dependencies or access. Produce the result requested by the skill without inventing data or running unreviewed scripts.

Expected result: output matching the skill instructions, or a precise list of missing prerequisites. A read confirmation alone does not validate a first use. If an external resource is unavailable, that path remains untested.

Related skills