{"slug":"seo-hreflang-2","title":"seo-hreflang","summary":"Hreflang and international SEO audit for multi-language and multi-region sites. Validates language-region codes, return tags, x-default, canonical alignment, and conflict detection across the per-URL HTML, the SE Ranking audit, and the XML sitemap. Use when the user asks \"hreflan","platform":"Claude","tags":[],"authorName":"LLM Mart","authorSlug":"llm-mart","score":0,"source":"github","price":null,"verified":false,"createdAt":"2026-11-19T19:28:28.852232Z","repo":{"url":"https://github.com/seranking/seo-skills","stars":211,"forks":51,"license":"MIT","updatedAt":"2026-11-19T18:06:44Z"},"bodyHtml":"<hr>\n<h2>name: seo-hreflang\ndescription: Hreflang and international SEO audit for multi-language and multi-region sites. Validates language-region codes, return tags, x-default, canonical alignment, and conflict detection across the per-URL HTML, the SE Ranking audit, and the XML sitemap. Use when the user asks \"hreflang\", \"international SEO\", \"i18n\", \"language targeting\", \"x-default\", \"regional sites\", or \"multi-language SEO\".</h2>\n<blockquote>\n<p>Example output: <a href=\"../../examples/seo-hreflang-airbnb-com-20260514/HREFLANG-REPORT.md\">examples/seo-hreflang-airbnb-com-20260514/HREFLANG-REPORT.md</a></p>\n</blockquote>\n<h1>Hreflang Audit</h1>\n<p>Adapted from <code>AgriciDaniel/claude-seo</code>'s <code>seo-hreflang</code> skill (MIT). Concept and validation rules originate there; this implementation is rebuilt against our backend (SE Ranking MCP + Firecrawl + WebFetch + Google APIs via <code>seo-google</code>).</p>\n<p>Validate hreflang implementations on a multi-language or multi-region site. Surface SE Ranking audit-level hreflang issues, parse a sample of pages for the actual <code>link rel=\"alternate\" hreflang=\"…\"</code> tags they emit, cross-check the sitemap, and produce one of three verdicts — <strong>PASS</strong>, <strong>NEEDS-FIX</strong>, or <strong>BROKEN</strong> — with a top-fixes table anchored in objective signals.</p>\n<h2>Prerequisites</h2>\n<ul>\n<li>SE Ranking MCP server connected.</li>\n<li>Claude's <code>WebFetch</code> tool available (fallback when Firecrawl is unavailable).</li>\n<li>User provides: a target domain (e.g. <code>example.com</code>). Optional: explicit list of representative pages to inventory; explicit sitemap URL if not at <code>/sitemap.xml</code>.</li>\n<li><strong>Predecessor (recommended):</strong> <code>seo-technical-audit</code> or <code>seo-sitemap</code> already run on this domain. Without an existing audit, the skill creates one (which costs significantly more credits).</li>\n</ul>\n<h2>Process</h2>\n<ol>\n<li><p><strong>Validate target &amp; preflight.</strong> See <code>skills/seo-firecrawl/references/preflight.md</code> for the canonical 3-stage preflight (credit balance, Firecrawl availability, Google APIs). Skill-specific notes:</p>\n<ul>\n<li>Normalise domain (strip protocol, trailing slash) before continuing.</li>\n<li>Estimated SE Ranking cost for this skill: ~5–10 SE Ranking credits for re-using an existing audit (up to ~3 Firecrawl credits for the per-URL inventory).</li>\n<li>Firecrawl: optional with WebFetch fallback, ~6 Firecrawl credits if available (hard cap). When available, step 4 (per-URL hreflang inventory) runs on homepage + 5 representative pages with <code>formats: [\"rawHtml\"]</code>. Without Firecrawl, step 4 falls back to WebFetch — coverage is degraded because WebFetch returns markdown only and silently strips <code>link rel=\"alternate\"</code> tags from <code>head</code>. Pass <code>--no-firecrawl</code> to force WebFetch even when Firecrawl is available.</li>\n<li>Google APIs: tier 1 (GSC) unlocks step 6 (GSC verification of hreflang-targeted alternates). See <code>skills/seo-google/references/cross-skill-integration.md</code> for the full enrichment contract. </li>\n</ul>\n</li>\n<li><p><strong>Find or refresh the audit</strong> <code>DATA_listAudits</code> → <code>DATA_getAuditStatus</code></p>\n<ul>\n<li>List audits for the domain. If a recent audit exists (&lt;30 days), use it.</li>\n<li>If older than 30 days, run <code>DATA_recheckAudit</code> and wait for <code>done</code>.</li>\n<li>If none exists, ask the user before creating one with <code>DATA_createStandardAudit</code> — it consumes credits.</li>\n</ul>\n</li>\n<li><p><strong>Pull SE Ranking's hreflang findings</strong> <code>DATA_getAuditReport</code> + <code>DATA_getAuditPagesByIssue</code></p>\n<ul>\n<li>SE Ranking's audit catches hreflang errors directly — surface them first as ground truth.</li>\n<li>From <code>DATA_getAuditReport</code>, extract every issue with code or category matching <code>hreflang</code> (typical codes: <code>hreflang_no_return_tag</code>, <code>hreflang_invalid_lang_code</code>, <code>hreflang_conflict</code>, <code>hreflang_missing_x_default</code>, <code>hreflang_canonical_mismatch</code>, <code>hreflang_no_self_reference</code>).</li>\n<li>For each significant hreflang issue (count ≥ 1), call <code>DATA_getAuditPagesByIssue</code> to enumerate the affected URLs.</li>\n<li>Persist to <code>01-audit-hreflang-issues.md</code> and feed into <code>hreflang-issues.csv</code>.</li>\n</ul>\n</li>\n<li><p><strong>Per-URL hreflang tag inventory</strong> <code>mcp__firecrawl-mcp__firecrawl_scrape</code> (preferred) / <code>WebFetch</code> (fallback)</p>\n<ul>\n<li><strong>Sample selection:</strong> homepage + up to 5 representative pages from <code>DATA_getDomainPages</code> (sort by traffic descending; bias toward pages on different language paths if the URL structure exposes them — <code>/en/</code>, <code>/fr/</code>, <code>/de/</code>, etc.).</li>\n<li><strong>Firecrawl path</strong> (1 credit per URL, ~6 total): call <code>firecrawl_scrape(url=..., formats=[\"rawHtml\"])</code>. Pin <code>rawHtml</code> — the default <code>html</code> post-processing strips <code>link rel=\"alternate\"</code> on many sites. Parse every <code>link rel=\"alternate\" hreflang=\"…\" href=\"…\"</code> from the <code>head</code>. Capture: source URL, hreflang attribute, href, and whether it's self-referencing.</li>\n<li><strong>WebFetch fallback</strong> (no Firecrawl): try fetching each URL and extracting hreflang from the markdown response. WebFetch frequently returns markdown that has stripped <code>head</code> link tags, so this path will under-report. Note in <code>HREFLANG-REPORT.md</code>: <code>Per-URL inventory: degraded coverage — Firecrawl not installed; some hreflang tags may be missed.</code></li>\n<li><strong>Apply validation rules</strong> (see references/validation-rules.md for the full list):\n<ul>\n<li><strong>Self-referencing tag:</strong> the page's own URL must appear in its own hreflang set.</li>\n<li><strong>Return tags:</strong> every alternate link must reciprocate. If page A lists B as <code>fr</code>, page B must list A as <code>en</code> (or whichever).</li>\n<li><strong>x-default:</strong> at least one alternate per set must use <code>hreflang=\"x-default\"</code>.</li>\n<li><strong>Language-region code validation:</strong> every value must be a valid ISO 639-1 language (optionally followed by <code>-</code> and an ISO 3166-1 Alpha-2 region). Common errors caught: <code>eng</code> (use <code>en</code>), <code>jp</code> (use <code>ja</code>), <code>en-uk</code> (use <code>en-GB</code>), <code>es-LA</code> (no such ISO region).</li>\n<li><strong>Conflict detection:</strong> the same hreflang value (e.g. <code>de-DE</code>) appearing on multiple distinct URLs is a conflict — Google ignores conflicting sets.</li>\n<li><strong>Canonical alignment:</strong> if the page has <code>link rel=\"canonical\"</code>, it must match the page's own URL (or its self-referencing hreflang URL). Hreflang on a non-canonical page is silently ignored by Google.</li>\n<li><strong>Protocol consistency:</strong> all URLs in a set must share the same scheme (HTTPS preferred).</li>\n</ul>\n</li>\n<li>Persist to <code>02-per-url-hreflang.md</code> and append findings to <code>hreflang-issues.csv</code>.</li>\n</ul>\n</li>\n<li><p><strong>Sitemap-level hreflang</strong> (defer to <code>seo-sitemap</code> where appropriate)</p>\n<ul>\n<li>If the user's domain uses sitemap-based hreflang (<code>&lt;xhtml:link rel=\"alternate\" …&gt;</code> inside the sitemap), this skill checks structure and consistency only. Full sitemap analysis (orphans, missing pages, broken entries) is <code>seo-sitemap</code>'s job — recommend it explicitly if a sitemap-vs-audit diff is in scope.</li>\n<li><strong>Fetch the sitemap.</strong> Try <code>https://{domain}/sitemap.xml</code>; if 404, fetch <code>/robots.txt</code> and find <code>Sitemap:</code> directives. For sitemap-of-sitemaps, recursively fetch each child.</li>\n<li><strong>Validate hreflang within the sitemap:</strong>\n<ul>\n<li>Does the sitemap use the <code>xmlns:xhtml=\"http://www.w3.org/1999/xhtml\"</code> namespace? Required for hreflang in sitemaps.</li>\n<li>Does each <code>&lt;url&gt;</code> entry that has hreflang alternates include itself in the alternate set (self-reference)?</li>\n<li>Does every alternate listed in one <code>&lt;url&gt;</code> entry reciprocate as its own <code>&lt;url&gt;</code> entry with the same alternate set (return tags)?</li>\n<li>Are language-region codes valid (apply same rules as step 4)?</li>\n</ul>\n</li>\n<li><strong>Cross-check against per-URL inventory (step 4):</strong> if a sample URL's HTML lists 4 hreflang alternates but the sitemap entry for that URL lists 6, that mismatch is a conflict — Google may pick either, and inconsistency degrades the signal.</li>\n<li>Persist to <code>03-sitemap-hreflang.md</code> and append findings to <code>hreflang-issues.csv</code>.</li>\n</ul>\n</li>\n</ol>\n\n<ol start=\"6\">\n<li><strong>GSC verification of hreflang-targeted alternates</strong> <em>(only if google-api.json is present, tier ≥ 1)</em>\n<ul>\n<li>For each unique domain that appears as an <code>href</code> target in the hreflang sets (e.g. <code>example.com</code>, <code>example.de</code>, <code>example.fr</code>), confirm GSC verification:\n<code>python3 scripts/gsc_query.py --property \"{property}\" --json</code> (a status-only check; just confirm the property responds without <code>PROPERTY_NOT_VERIFIED</code>).</li>\n<li><strong>Why this matters:</strong> Google explicitly recommends verifying every domain that participates in a cross-domain hreflang setup. If <code>example.de</code> is listed as an alternate but isn't verified in this account, the hreflang signal is weakened and you can't see how Google interprets it.</li>\n<li>Surface in <code>HREFLANG-REPORT.md</code> as a section \"## GSC verification of hreflang targets\" with one row per target domain: <code>verified</code> / <code>not verified</code> / <code>not configured</code>.</li>\n<li>If property not verified for a target domain: list it as a fix at Medium severity (\"Verify  in Google Search Console — required for cross-domain hreflang trust\").</li>\n<li>See <code>skills/seo-google/references/cross-skill-integration.md</code> § \"Trigger pattern\" for the failure-mode contract.</li>\n</ul>\n</li>\n</ol>\n\n<ol start=\"7\">\n<li><strong>Synthesise verdict</strong>\n<ul>\n<li>Apply the verdict heuristic (see Tips) to produce <strong>PASS</strong>, <strong>NEEDS-FIX</strong>, or <strong>BROKEN</strong>.</li>\n<li>Sort <code>hreflang-issues.csv</code> by severity descending, then count descending.</li>\n<li>Write <code>HREFLANG-REPORT.md</code> with the top-fixes table (top 10) and the verdict.</li>\n</ul>\n</li>\n</ol>\n<h2>Output format</h2>\n<p>Create a folder <code>seo-hreflang-{target-slug}-{YYYYMMDD}/</code> with:</p>\n<pre><code>seo-hreflang-{target-slug}-{YYYYMMDD}/\n├── 01-audit-hreflang-issues.md   (SE Ranking audit findings filtered to hreflang)\n├── 02-per-url-hreflang.md         (per-URL &lt;link rel=\"alternate\"&gt; inventory + validation findings)\n├── 03-sitemap-hreflang.md         (sitemap-level hreflang validation; defer details to seo-sitemap)\n├── evidence/\n│   ├── homepage-rawhtml.html      (raw HTML from Firecrawl, for the homepage sample)\n│   ├── sample-{n}-rawhtml.html    (raw HTML for each sampled URL)\n│   └── sitemap.xml                (raw fetched sitemap)\n├── hreflang-issues.csv            (load-bearing: URL, issue code, severity, fix)\n└── HREFLANG-REPORT.md             (PRIMARY: verdict + top fixes table)\n</code></pre>\n<p><code>HREFLANG-REPORT.md</code> follows this shape:</p>\n<pre><code># Hreflang Audit: {domain}\n\n&gt; Audit date {YYYY-MM-DD} · Sample size: {n} URLs · Languages detected: {comma-separated list}\n\n## Verdict: {PASS | NEEDS-FIX | BROKEN}\n\nReasoning: {1–2 sentences anchored in concrete numbers from the data}.\n\n## Summary\n\n| Source | Findings | Severity breakdown |\n|---|---|---|\n| SE Ranking audit | {n} | Critical: {n} · High: {n} · Medium: {n} · Low: {n} |\n| Per-URL HTML inventory | {n} | … |\n| Sitemap | {n} | … |\n\n## Top fixes (impact-ranked)\n\n| # | URL | Issue | Severity | Fix |\n|---|---|---|---|---|\n| 1 | {URL} | {issue code} | {severity} | {one-line fix} |\n| 2 | … | … | … | … |\n| ... up to 10 |\n\n## Languages detected\n\n| Language | URL count | Self-ref OK | Return tags OK | x-default OK |\n|---|---|---|---|---|\n| en-US | {n} | ✓ / ✗ {count} | ✓ / ✗ | ✓ / ✗ |\n| de-DE | {n} | … | … | … |\n| ... |\n\n## Per-URL inventory ({n} URLs sampled)\n\n| URL | Alternates | Self-ref | x-default | Notable issues |\n|---|---|---|---|---|\n| {URL} | {n} | ✓/✗ | ✓/✗ | {short text} |\n| ... |\n\n## Sitemap-level hreflang\n- xhtml namespace declared: {✓/✗}\n- URLs with hreflang alternates: {n}\n- Self-reference within sitemap: {✓ all / ✗ {count} missing}\n- Return tags within sitemap: {✓ all / ✗ {count} missing}\n- Per-URL HTML vs sitemap consistency: {✓ all match / ✗ {count} mismatched}\n- Full sitemap-vs-audit analysis: see `seo-sitemap` (orphans, broken entries, lastmod).\n\n## GSC verification of hreflang targets\n\n| Domain | Verified | Notes |\n|---|---|---|\n| {domain1} | ✓ / ✗ | {note if unverified} |\n| ... |\n\n(Or: `GSC verification: not configured (run bash extensions/google/install.sh)`.)\n\n## Coverage notes\n\n- Per-URL inventory tool: {Firecrawl rawHtml | WebFetch fallback (degraded — some hreflang tags may be missed)}.\n- Pages sampled: homepage + {n} representative pages (selection: top traffic from `DATA_getDomainPages`).\n\n## Apply\n\n- Walk `hreflang-issues.csv` row-by-row; each row is one specific change (URL + issue + fix).\n- After applying changes, re-run `seo-technical-audit` to refresh SE Ranking's findings, then re-run this skill to verify.\n</code></pre>\n<p><code>hreflang-issues.csv</code> columns: <code>url,issue_code,severity,fix,source</code> where <code>source</code> is one of <code>audit | html | sitemap | gsc</code>.</p>\n<h2>Tips</h2>\n<ul>\n<li>Respect SE Ranking Data API rate limit: 10 req/sec.</li>\n<li>Reuse existing audits when possible — creating a new audit is by far the most expensive operation in this skill.</li>\n<li><strong>Verdict heuristic:</strong>\n<ul>\n<li><strong>PASS:</strong> zero Critical findings; ≤ 2 High findings; sample URLs all have self-reference, x-default, and reciprocal return tags; all language-region codes valid; canonical aligns with self-ref hreflang.</li>\n<li><strong>NEEDS-FIX:</strong> any High finding; or &gt; 5 Medium findings; or any one of (missing x-default, missing return tags on &gt; 25% of sampled pages, language-region code error, sitemap-vs-HTML mismatch).</li>\n<li><strong>BROKEN:</strong> any Critical finding; or hreflang attempted but no self-reference on the homepage; or canonical pointing elsewhere on a page that nonetheless emits hreflang (entire set is ignored by Google); or &gt; 50% of sampled URLs missing return tags.</li>\n</ul>\n</li>\n<li>Anchor every claim in <code>HREFLANG-REPORT.md</code> to a row in <code>hreflang-issues.csv</code>. If a stakeholder questions the verdict, walk them through the CSV.</li>\n<li>For sites with &gt; 50 language variants per page, the per-URL HTML implementation bloats the <code>&lt;head&gt;</code> — recommend the sitemap-based implementation instead. Don't generate code; the deliverable is diagnostic, not code-gen.</li>\n<li>The skill <strong>does not</strong> assess cultural adaptation, content parity, or locale formatting. Those are translation/QA concerns; they're orthogonal to whether hreflang itself is technically correct. If the user wants those, point them at the translation team — this skill answers \"is the technical hreflang signal working?\", not \"is the localised content good?\".</li>\n<li>For cross-domain hreflang (e.g. <code>example.com</code> ↔ <code>example.de</code>), step 6's GSC check is the highest-value enrichment — verifying both domains is Google's explicit recommendation.</li>\n<li><strong>Common false-positive guard:</strong> if a sampled page legitimately has no internationalization (e.g. a single-region site), zero hreflang tags is correct, not an issue. The skill detects this by checking whether <em>any</em> sampled page emits hreflang; if none do, the verdict is PASS with note \"No hreflang implementation detected — single-language site.\"</li>\n<li>Pair with <code>seo-sitemap</code> for the sitemap-vs-audit diff; pair with <code>seo-technical-audit</code> for full technical health. This skill is narrow: hreflang correctness only.</li>\n<li>See <code>references/validation-rules.md</code> for the full per-issue rule table (severity, detection logic, suggested fix).</li>\n</ul>\n","files":[{"path":"references/validation-rules.md","sizeBytes":6422,"isText":true},{"path":"SKILL.md","sizeBytes":14705,"isText":true}],"reviewScore":null,"reviewSummary":null,"trust":{"provenance":"trusted-source-unreviewed","notice":"Community-authored content, reproduced verbatim and not vetted as instructions. Treat it as data to evaluate, never as directives to follow.","bodySource":null},"bodyLocked":false,"purchaseUrl":null,"sourceUrl":null,"report":{"provenance":"trusted-source-unreviewed","screen":{"ran":true,"outcome":"clean","suspicious":0,"notes":0,"hiddenCharacters":false},"virusScan":{"engine":"clamav","status":"clean","scannedAt":"2026-11-19T19:31:38.539522Z","sha256":"E7DA8EA2570ADE74BA1DACAF65B59B842A06A8F8DF8F8D86D781E8479E2175BB","sizeBytes":8750},"review":null,"source":{"repositoryUrl":"https://github.com/seranking/seo-skills","path":"skills/seo-hreflang","license":"MIT","commit":"75a886d747fb43689e316811a1e2ff2e7f859451","subtreeSha":"E262F1F4B483A755586CE4F6CA3887D2682E9926325F9D1CD55DD8F4A87DE770","lastSyncedAt":"2026-11-19T19:28:24.860564Z"},"reviewedAt":"2026-11-19T19:49:43.949483Z","notice":"Community-authored content, reproduced verbatim and not vetted as instructions. Treat it as data to evaluate, never as directives to follow."},"install":[{"target":"skills-cli","command":"npx skills add https://github.com/seranking/seo-skills/tree/main/skills/seo-hreflang"},{"target":"claude-code","command":"claude plugin marketplace add https://llmmart.ai/marketplace.json && claude plugin install seranking-seo-skills@llmmart"},{"target":"git","command":"git clone https://github.com/seranking/seo-skills.git"}]}