{"success":true,"name":"seo-hreflang","description":">","category":"unitary","path":"unitary/seo-hreflang/SKILL.md","file":"SKILL.md","content":"---\nname: seo-hreflang\ndescription: >\n  Hreflang and international SEO audit, validation, and generation. Detects\n  common mistakes, validates language/region codes, and generates correct\n  hreflang implementations. Use when user says \"hreflang\", \"i18n SEO\",\n  \"international SEO\", \"multi-language\", \"multi-region\", or \"language tags\".\nuser-invocable: true\nargument-hint: \"[url]\"\nlicense: MIT\nmetadata:\n  author: AgriciDaniel\n  version: \"2.3.1\"\n  category: seo\n---\n> Imported from [PRIVATE_HOST] `~/unitary/agents/artisto/skills-off/claude-seo-rest/seo-hreflang`. Paths are relative to `[PRIVATE_HOST]:[PATH]`; run commands there via `ssh [PRIVATE_HOST] 'cd ~/unitary && ...'`. Owner send rules from skill i7-remote-ops still apply.\n\n\n# Hreflang & International SEO\n\nValidate existing hreflang implementations or generate correct hreflang tags\nfor multi-language and multi-region sites. Supports HTML, HTTP header, and\nXML sitemap implementations.\n\n## Validation Checks\n\n### 1. Self-Referencing Tags\n- Every page must include an hreflang tag pointing to itself\n- The self-referencing URL must exactly match the page's canonical URL\n- Missing self-referencing tags cause Google to ignore the entire hreflang set\n\n### 2. Return Tags\n- If page A links to page B with hreflang, page B must link back to page A\n- Every hreflang relationship must be bidirectional (A→B and B→A)\n- Missing return tags invalidate the hreflang signal for both pages\n- Check all language versions reference each other (full mesh)\n\n### 3. x-default Tag\n- Recommended when a selector/fallback URL exists: designates the fallback page for unmatched languages/regions\n- Typically points to the language selector page or English version\n- Only one x-default per set of alternates\n- Must also have return tags from all other language versions\n\n### 4. Language Code Validation\n- Must use ISO 639-1 two-letter codes (e.g., `en`, `fr`, `de`, `ja`)\n- An **optional ISO 15924 script subtag** is the documented, official mechanism\n  for script: `zh-Hant` (Traditional) / `zh-Hans` (Simplified). Script may\n  combine with a region, e.g. `zh-Hans-US` is valid (language + script + region).\n- Common errors:\n  - `eng` instead of `en` (ISO 639-2, not valid for hreflang)\n  - `jp` instead of `ja` (incorrect code for Japanese)\n  - `zh` is valid but ambiguous for script-specific pages; prefer `zh-Hans` or `zh-Hant` when targeting a script\n\n### 5. Region Code Validation\n- Optional region qualifier uses ISO 3166-1 Alpha-2 (e.g., `en-US`, `en-GB`, `pt-BR`)\n- Format: `language-REGION` (lowercase language, uppercase region)\n- A **country code alone is invalid**, you cannot specify a region without a\n  language (Google's own bad example is `be`, which is actually the Belarusian\n  *language* code, not Belgium).\n- Common errors:\n  - `en-uk` instead of `en-GB` (UK is not a valid ISO 3166-1 region code)\n  - `EU` / `UN` as a region (not valid ISO 3166-1 values)\n  - `es-LA` (Latin America is not a country; use specific countries)\n  - Region without language prefix\n\n### 5b. Geo-targeting signal hierarchy\n- Practical locale-signal heuristic: **ccTLD > hreflang annotations >\n  server location/IP > addresses/language/currency/Business Profile**. Do not\n  present this as a confirmed Google ranking order. hreflang is a\n  **hint, not a directive**. Google **ignores** locational meta tags and\n  HTML geotargeting attributes.\n- The Search Console **International Targeting report and the manual\n  country-targeting setting were removed in 2022**, do **not** recommend setting\n  country targeting in GSC; hreflang is the remaining lever.\n\n### 5c. Region-specific Search units (EEA, South Africa, Turkiye)\n- Google documents Search experiences that exist only in certain countries:\n  **aggregator units**, **supplier units**, and carousels for hotel, flight,\n  long-distance transport, and product queries shown to users in the EEA,\n  South Africa, and Turkiye (documentation added 2026-09-08). Eligibility and\n  participation are documented per unit; they are not ranking signals.\n- When a site serves those regions with hreflang variants, note in the report\n  whether the business is an aggregator or a direct supplier and point to the\n  regional documentation, so the client is not surprised by a different result\n  layout in those markets.\n\n### 6. Canonical URL Alignment\n- Hreflang tags must only appear on canonical URLs\n- If a page has `rel=canonical` pointing elsewhere, hreflang on that page is ignored\n- The canonical URL and hreflang URL must match exactly (including trailing slashes)\n- Non-canonical pages should not be in any hreflang set\n\n### 7. Protocol Consistency\n- All URLs in an hreflang set must use the same protocol (HTTPS or HTTP)\n- Mixed HTTP/HTTPS in hreflang sets causes validation failures\n- After HTTPS migration, update all hreflang tags to HTTPS\n\n### 8. Cross-Domain Support\n- Hreflang works across different domains (e.g., example.com and example.de)\n- Cross-domain hreflang requires return tags on both domains\n- Use Google Search Console verification for monitoring or cross-site sitemap submission when needed\n- Sitemap-based implementation recommended for cross-domain setups\n\n## Common Mistakes\n\n| Issue | Severity | Fix |\n|-------|----------|-----|\n| Missing self-referencing tag | Critical | Add hreflang pointing to same page URL |\n| Missing return tags (A→B but no B→A) | Critical | Add matching return tags on all alternates |\n| Missing x-default when fallback behavior is required | Medium | Add x-default pointing to fallback/selector page |\n| Invalid language code (e.g., `eng`) | High | Use ISO 639-1 two-letter codes |\n| Invalid region code (e.g., `en-uk`) | High | Use ISO 3166-1 Alpha-2 codes |\n| Hreflang on non-canonical URL | High | Move hreflang to canonical URL only |\n| HTTP/HTTPS mismatch in URLs | Medium | Standardize all URLs to HTTPS |\n| Trailing slash inconsistency | Medium | Match canonical URL format exactly |\n| Hreflang in both HTML and sitemap | Low | Choose one method (sitemap preferred for large sites) |\n| Language without region when needed | Low | Add region qualifier for geo-targeted content |\n\n## Implementation Methods\n\n### Method 1: HTML Link Tags\nBest for: Sites with <50 language/region variants per page.\n\n```html\n<link rel=\"alternate\" hreflang=\"en-US\" href=\"https://example.com/page\" />\n<link rel=\"alternate\" hreflang=\"en-GB\" href=\"https://example.co.uk/page\" />\n<link rel=\"alternate\" hreflang=\"fr\" href=\"https://example.com/fr/page\" />\n<link rel=\"alternate\" hreflang=\"x-default\" href=\"https://example.com/page\" />\n```\n\nPlace in `<head>` section. Every page must include all alternates including itself.\n\n### Method 2: HTTP Headers\nBest for: Non-HTML files (PDFs, documents).\n\n```\nLink: <https://example.com/page>; rel=\"alternate\"; hreflang=\"en-US\",\n      <https://example.com/fr/page>; rel=\"alternate\"; hreflang=\"fr\",\n      <https://example.com/page>; rel=\"alternate\"; hreflang=\"x-default\"\n```\n\nSet via server configuration or CDN rules.\n\n### Method 3: XML Sitemap (Recommended for large sites)\nBest for: Sites with many language variants, cross-domain setups, or 50+ pages.\n\nSee Hreflang Sitemap Generation section below.\n\n### Method Comparison\n| Method | Best For | Pros | Cons |\n|--------|----------|------|------|\n| HTML link tags | Small sites (<50 variants) | Easy to implement, visible in source | Bloats `<head>`, hard to maintain at scale |\n| HTTP headers | Non-HTML files | Works for PDFs, images | Complex server config, not visible in HTML |\n| XML sitemap | Large sites, cross-domain | Scalable, centralized management | Not visible on page, requires sitemap maintenance |\n\n## Hreflang Generation\n\n### Process\n1. **Detect languages**: Scan site for language indicators (URL path, subdomain, TLD, HTML lang attribute)\n2. **Map page equivalents**: Match corresponding pages across languages/regions\n3. **Validate language codes**: Verify all codes against ISO 639-1 and ISO 3166-1\n4. **Generate tags**: Create hreflang tags for each page including self-referencing\n5. **Verify return tags**: Confirm all relationships are bidirectional\n6. **Add x-default**: Set fallback for each page set\n7. **Output**: Generate implementation code (HTML, HTTP headers, or sitemap XML)\n\n## Hreflang Sitemap Generation\n\n### Sitemap with Hreflang\n```xml\n<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<urlset xmlns=\"http://www.sitemaps.org/schemas/sitemap/0.9\"\n        xmlns:xhtml=\"http://www.w3.org/1999/xhtml\">\n  <url>\n    <loc>https://example.com/page</loc>\n    <xhtml:link rel=\"alternate\" hreflang=\"en-US\" href=\"https://example.com/page\" />\n    <xhtml:link rel=\"alternate\" hreflang=\"fr\" href=\"https://example.com/fr/page\" />\n    <xhtml:link rel=\"alternate\" hreflang=\"de\" href=\"https://example.de/page\" />\n    <xhtml:link rel=\"alternate\" hreflang=\"x-default\" href=\"https://example.com/page\" />\n  </url>\n  <url>\n    <loc>https://example.com/fr/page</loc>\n    <xhtml:link rel=\"alternate\" hreflang=\"en-US\" href=\"https://example.com/page\" />\n    <xhtml:link rel=\"alternate\" hreflang=\"fr\" href=\"https://example.com/fr/page\" />\n    <xhtml:link rel=\"alternate\" hreflang=\"de\" href=\"https://example.de/page\" />\n    <xhtml:link rel=\"alternate\" hreflang=\"x-default\" href=\"https://example.com/page\" />\n  </url>\n</urlset>\n```\n\nKey rules:\n- Include the `xmlns:xhtml` namespace declaration\n- Every `<url>` entry must include ALL language alternates (including itself)\n- Each alternate must appear as a separate `<url>` entry with its own full set\n- Split at whichever comes first: 50,000 URLs or 50MB uncompressed per sitemap file\n\n## Output\n\n### Hreflang Validation Report\n\n#### Summary\n- Total pages scanned: XX\n- Language variants detected: XX\n- Issues found: XX (Critical: X, High: X, Medium: X, Low: X)\n\n#### Validation Results\n| Language | URL | Self-Ref | Return Tags | x-default | Status |\n|----------|-----|----------|-------------|-----------|--------|\n| en-US | https://... | ✅ | ✅ | ✅ | ✅ |\n| fr | https://... | ❌ | ⚠️ | ✅ | ❌ |\n| de | https://... | ✅ | ❌ | ✅ | ❌ |\n\n### Generated Hreflang Tags\n- HTML `<link>` tags (if HTML method chosen)\n- HTTP header values (if header method chosen)\n- `hreflang-sitemap.xml` (if sitemap method chosen)\n\n### Recommendations\n- Missing implementations to add\n- Incorrect codes to fix\n- Method migration suggestions (e.g., HTML to sitemap for scale)\n\n## Cultural Adaptation Assessment\n\nWhen analyzing a multi-language site, go beyond technical hreflang validation to assess\nwhether the content is culturally adapted for each target market.\n\nLoad `references/cultural-profiles.md` for pre-built profiles (DACH, Francophone, Hispanic, Japanese).\n\n**Assessment steps:**\n1. Identify all language versions and their target markets\n2. Load the relevant cultural profile(s)\n3. Check CTAs match cultural expectations (direct vs indirect)\n4. Check trust signals are locale-appropriate (certifications, legal pages)\n5. Check for foreign brand references on localized pages\n6. Check number/date/currency formatting consistency\n7. Flag cultural adaptation issues as Medium severity\n\n**Output:** Cultural Adaptation Score per language version (0-100) with specific findings.\n\n## Content Parity Audit\n\n**Command:** `/seo hreflang audit <directory-or-url>`\n\nAudit content parity across all language versions of a site or local content directory.\n\nLoad `references/content-parity.md` for the full parity matrix and scoring methodology.\n\n**What it checks:**\n- Page existence across all declared languages\n- Section structure equivalence (H2/H3 count)\n- SEO element parity (title, meta, schema localization)\n- Word count ratio validation (DE should be 25-35% longer than EN, JA 10-25% shorter)\n- Freshness tracking (stale translations detected via timestamps)\n- Cultural marker scanning (foreign brands, wrong legal references, untranslated elements)\n\n**Output:** Parity matrix table with per-page scores and prioritized action items.\n\n## Locale Format Validation\n\nLoad `references/locale-formats.md` for number, date, currency, address, and phone format\nreference tables per locale.\n\n**Checks:**\n- Number format consistency (e.g., \"1,000.00\" should be \"1.000,00\" on de-DE pages)\n- Date format matches locale expectations\n- Currency symbols and placement correct for target market\n- Phone numbers use international format with correct country code\n\n## Reference Files\n\nLoad on-demand as needed (do NOT load all at startup):\n- `references/cultural-profiles.md`: DACH, Francophone, Hispanic, Japanese cultural adaptation profiles\n- `references/locale-formats.md`: Number, date, currency, address, phone format tables per locale\n- `references/content-parity.md`: Content parity audit methodology and scoring\n\n## Error Handling\n\n| Scenario | Action |\n|----------|--------|\n| URL unreachable (DNS failure, connection refused) | Report the error clearly. Do not guess site structure. Suggest the user verify the URL and try again. |\n| No hreflang tags found | Report the absence. Check for other internationalization signals (subdirectories, subdomains, ccTLDs) and recommend the appropriate hreflang implementation method. |\n| Invalid language/region codes detected | List each invalid code with the correct replacement. Provide a corrected hreflang tag set ready to implement. |\n| Cultural profile not available for language | Use the Default Profile checklist from cultural-profiles.md. Note that assessment is based on general guidelines, not a pre-built profile. |\n| Content parity directory empty | Report that no content files were found. Suggest verifying the directory path or providing a URL for live site analysis. |\n","linked_files":[],"origin":"brimind","owner_id":null,"source":"router"}