HOME SKILLS BLOG GITHUB
// SKILL

HREFLANG AUDIT
INTERNATIONAL SEO

A hreflang audit is a check of language and regional annotations that helps search engines select the correct page version. Claude SEO validates existing implementations or generates tags for multilingual and multiregional sites across HTML, HTTP header, and XML sitemap methods.

By Daniel Agrici · Last updated: · Source: Google Search Central

$
/seo hreflang https://your-site.com

REQUIRES CLAUDE SEO INSTALLED IN CLAUDE CODE

Claude SEO hreflang international SEO audit
// HOW IT WORKS

What does a hreflang audit validate?

When you run /seo hreflang, Claude SEO scans your site for hreflang implementations across all three standard methods: HTML link tags, HTTP headers, and XML sitemaps. It validates every tag against 8 critical checks and flags issues by severity.

The tool detects language indicators from URL paths, subdomains, TLDs, and HTML lang attributes. It maps equivalent pages across languages, validates ISO 639-1 language codes and ISO 3166-1 region codes, and verifies that every hreflang relationship is bidirectional.

1. SCAN SITE HTML TAGS <link> in head HTTP HEADERS Link: header XML SITEMAP xhtml:link 2. VALIDATE Self-referencing tags Return tags (A-B, B-A) x-default presence ISO 639-1 / 3166-1 codes Canonical alignment Protocol consistency VALIDATION REPORT + GENERATED TAGS HTML, HTTP headers, or hreflang-sitemap.xml

What each validation check covers

The hreflang audit runs 8 checks across your entire site. Missing self-referencing tags and missing return tags are the two most common mistakes, and both cause Google to ignore the entire hreflang set for affected pages.

01
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.
02
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. Missing return tags invalidate the signal for both pages.
03
X-DEFAULT TAG
Designates the fallback page for unmatched languages or regions. Typically points to the language selector page or English version. Only one x-default per set of alternates.
04
LANGUAGE CODES
Must use ISO 639-1 two-letter codes. Detects common errors like "eng" instead of "en", "jp" instead of "ja", and "zh" without a region qualifier for Chinese variants.
05
REGION CODES
Optional region qualifier uses ISO 3166-1 Alpha-2 format. Catches errors like "en-uk" (should be "en-GB"), "es-LA" (Latin America is not a country), and missing language prefixes.
06
CANONICAL ALIGNMENT
Hreflang tags must only appear on canonical URLs. If a page has rel=canonical pointing elsewhere, hreflang on that page is ignored. URLs must match exactly, including trailing slashes.
07
PROTOCOL CONSISTENCY
All URLs in an hreflang set must use the same protocol. Mixed HTTP and HTTPS in hreflang sets causes validation failures. Flags sites that need post-migration updates.
08
CROSS-DOMAIN SUPPORT
Validates hreflang across different domains, for example example.com and example.de. Checks return tags on both domains and recommends sitemap-based implementation for cross-domain setups.
GENERATOR
TAG GENERATION
Generates complete hreflang tag sets in your preferred format: HTML link tags, HTTP Link headers, or XML sitemap with xhtml:link namespace. Includes self-referencing and x-default tags automatically.
// COMMON MISTAKES

Which hreflang errors are detected?

These are the most common hreflang implementation mistakes. Claude SEO flags each one with a severity level and provides the exact fix needed.

IssueSeverityFix
Missing self-referencing tagCriticalAdd hreflang pointing to same page URL
Missing return tags (A to B but no B to A)CriticalAdd matching return tags on all alternates
Missing x-defaultHighAdd x-default pointing to fallback page
Invalid language code (e.g., eng)HighUse ISO 639-1 two-letter codes
Invalid region code (e.g., en-uk)HighUse ISO 3166-1 Alpha-2 codes
Hreflang on non-canonical URLHighMove hreflang to canonical URL only
HTTP/HTTPS mismatch in URLsMediumStandardize all URLs to HTTPS
Trailing slash inconsistencyMediumMatch canonical URL format exactly
Hreflang in both HTML and sitemapLowChoose one method (sitemap preferred for large sites)
Language without region when neededLowAdd region qualifier for geo-targeted content

Implementation method comparison

MethodBest forProsCons
HTML link tagsSmall sites (<50 variants)Easy to implement, visible in sourceBloats head, hard to maintain at scale
HTTP headersNon-HTML filesWorks for PDFs, imagesComplex server config, not visible in HTML
XML sitemapLarge sites, cross-domainScalable, centralized managementNot visible on page, requires sitemap maintenance
// USAGE

How do you run a hreflang audit?

Step 1: Install Claude SEO

git clone --depth 1 https://github.com/AgriciDaniel/claude-seo.git
bash claude-seo/install.sh

Step 2: Open Claude Code

claude

Step 3: Run the hreflang audit

/seo hreflang https://your-site.com

Claude SEO scans your site for all hreflang implementations, validates every tag against 8 checks, and generates a validation report with corrected tags ready to implement.

Generation process

When generating hreflang tags for a new implementation, the tool follows this 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 and 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)
// FAQ

QUESTIONS ABOUT HREFLANG

Claude SEO detects 10 common hreflang issues: missing self-referencing tags, missing return tags (bidirectional validation), missing x-default, invalid ISO 639-1 language codes (like "eng" instead of "en"), invalid ISO 3166-1 region codes (like "en-uk" instead of "en-GB"), hreflang on non-canonical URLs, HTTP/HTTPS protocol mismatch, trailing slash inconsistency, duplicate implementation methods, and missing region qualifiers.
// RELATED SKILLS

EXPLORE MORE

VIEW ALL 25 SKILLS →

// FROM THE BLOG

Learn how to use Claude SEO with our practical SEO guides for developers.

FIX YOUR HREFLANG
WITH RECIPROCAL VALIDATION.

$
git clone --depth 1 https://github.com/AgriciDaniel/claude-seo.git && bash claude-seo/install.sh
VIEW ON GITHUB ALL SKILLS >