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 · Command surface verified: · Source: Google Search Central

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

REQUIRES CLAUDE SEO INSTALLED IN CLAUDE CODE

International page variants connect through reciprocal language and region annotations
// RUN PREVIEW

What will happen if you start this skill?

Coverage is limited to retrieved resources, and source-level method heuristics still need current Google review.

OUTCOME

A hreflang diagnostic and tag draft across retrieved HTML, HTTP headers, and XML sitemaps.

REQUIRED INPUT

A reachable international page or site supplied to /seo hreflang <url>, with known locale intent when available.

READINESS

Blocked pages, authentication, crawl limits, and incomplete sitemap discovery reduce coverage. Equivalent pages need human confirmation.

LOCAL OUTPUT

A validation report and draft annotations using ISO 639-1, optional ISO 15924, optional region codes, and optional x-default.

SIDE EFFECTS

Fetches pages, headers, and sitemaps and may write local drafts. It does not implement tags or change production.

COST + APPROVAL

The base skill needs no paid SEO-data provider. Claude Code and network access can cost separately; implementation needs owner review.

// HOW IT WORKS

What does a hreflang audit validate?

When you run /seo hreflang, Claude SEO reviews the pages, HTTP headers, and XML sitemaps it can retrieve. It checks self-references, reciprocal links, code formats, canonical alignment, fully qualified URLs, and related implementation details. The report's coverage is limited to resources that were successfully fetched.

The tool proposes equivalents from URL paths, subdomains, TLDs, and HTML language attributes, but a person must confirm that the pages serve equivalent content. It validates ISO 639-1 language codes, optional ISO 15924 script subtags, optional ISO 3166-1 region codes, and reciprocal relationships.

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 when useful ISO 639-1 / 15924 / 3166-1 Canonical alignment Fully qualified URLs VALIDATION REPORT + GENERATED TAGS HTML, HTTP headers, or hreflang-sitemap.xml

What each validation check covers

The audit applies its review categories only to retrieved resources. The v2.2.5 source includes a transport-consistency rule and recommends sitemaps for some setups. Current Google guidance requires fully qualified alternate URLs and treats HTML, HTTP header, and sitemap methods as equivalent, so treat those source rules as operational review prompts rather than universal search requirements.

01
SELF-REFERENCING TAGS
Every alternate should list itself and the other versions. The self-reference should use the page's canonical URL. Missing entries can prevent the annotations from being processed as intended.
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
Optional fallback for unmatched languages or regions, often a selector page. The current generation process includes it, so remove or revise it when no real fallback exists.
04
LANGUAGE CODES
Uses ISO 639-1 language codes with optional ISO 15924 script subtags. "zh" is valid; use "zh-Hans" or "zh-Hant" when script targeting matters.
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
TRANSPORT REVIEW
The current skill flags mixed HTTP and HTTPS. Google instead requires complete canonical alternate URLs; mixed transport is a migration clue, not an error by itself.
08
CROSS-DOMAIN SUPPORT
Reviews reciprocal annotations across domains. The source recommends sitemaps here, but Google gives no search preference to sitemap over HTML for cross-domain use.
GENERATOR
TAG GENERATION
Drafts HTML link tags, HTTP Link headers, or XML sitemap annotations from retrieved evidence. The source process includes x-default, which needs fallback confirmation before use.
// 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-default when a fallback existsReviewConsider x-default for the selector or fallback URL
Invalid language code (e.g., eng)HighUse ISO 639-1 with an optional ISO 15924 script subtag
Invalid region code (e.g., en-uk)HighUse ISO 3166-1 Alpha-2 codes
Hreflang on non-canonical URLHighMove hreflang to canonical URL only
Mixed transport (current skill check)ReviewConfirm every alternate is fully qualified and canonical; mixed transport is not itself a Google error
Trailing slash inconsistencyMediumMatch canonical URL format exactly
Hreflang in both HTML and sitemapInfoChoose one method when duplicate maintenance creates risk; Google treats the methods as equivalent
Language without region when neededLowAdd region qualifier for geo-targeted content

Implementation method comparison

Google treats all three methods as equivalent for Search. The current skill source recommends sitemaps for scale and cross-domain setups; treat that as a maintenance preference, not an expected ranking benefit.

MethodCommon fitProsCons
HTML link tagsHTML pages with manageable alternate setsVisible in source and close to the pageCan be repetitive and hard to maintain at scale
HTTP headersNon-HTML filesWorks for PDFs, imagesComplex server config, not visible in HTML
XML sitemapTeams that prefer centralized annotationsCentralized 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 reviews the hreflang implementations it can retrieve and drafts corrections. The report must state any pages, headers, or sitemaps it could not access, and a person should verify page equivalence and canonical URLs before implementation.

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 ISO 639-1 language, optional ISO 15924 script, and optional ISO 3166-1 region codes
  4. Generate tags - create hreflang tags for each page including self-referencing
  5. Verify return tags - confirm all relationships are bidirectional
  6. Review x-default - the source process includes it; keep it only when a selector or fallback URL exists
  7. Output - generate implementation code (HTML, HTTP headers, or sitemap XML)
// FAQ

QUESTIONS ABOUT HREFLANG

On resources it retrieves, the v2.2.5 skill reviews self-references, reciprocal links, language and region codes, canonical alignment, formatting, x-default, and a source-defined transport-consistency rule. Google requires fully qualified canonical alternate URLs, but not one shared transport across every alternate. Treat mixed transport as a review clue, not a universal error. x-default is optional, and ISO 15924 script subtags such as zh-Hant and zh-Hans are valid.
// RELATED SKILLS

EXPLORE MORE

VIEW ALL 26 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 >