Prompt

I’m building a workflow for hreflang validation across country sites, how do I do it?

Technology / SEO & AEO Tools1 observationLast seen Oct 21, 2026

Latest observation

Oct 21, 2026OpenAI APIWeb search: off

Here’s a practical way to build a hreflang validation workflow for country/language sites.

1) Define the rules you want to validate

At minimum, your checker should confirm:

  • Every indexable localized page has hreflang tags
  • Each hreflang points to the correct URL
  • Reciprocal links exist
    If page A references page B, page B must reference page A.
  • Self-referencing hreflang exists
  • Language/region codes are valid
    e.g. en, en-GB, fr-FR, es-MX
  • Each cluster includes an x-default if required
  • All alternates are canonical/indexable
  • No broken URLs, redirects, 404s, or blocked pages
  • Only one hreflang set per page
  • Consistent implementation method
    HTML tags, HTTP headers, or XML sitemap — ideally one primary method

2) Decide where hreflang lives

Pick one source of truth:

Option A: HTML <link rel="alternate" hreflang="...">

Best for:

  • Smaller to medium sites
  • Easy page-level validation

Option B: XML sitemap hreflang annotations

Best for:

  • Large sites
  • Cleaner templates
  • Centralized generation

Option C: HTTP headers

Best for:

  • PDFs and non-HTML assets

Many teams use HTML + sitemap together, but if you do, make sure they match exactly.


3) Build the workflow in stages

Stage 1: Crawl

Use a crawler to collect:

  • All indexable URLs
  • Canonicals
  • Hreflang annotations
  • Status codes
  • Redirect chains
  • Robots/noindex flags

Tools you can use:

  • Screaming Frog
  • Sitebulb
  • Oncrawl
  • Custom crawler using Python + requests/BeautifulSoup or Playwright
  • Google Search Console exports as a supplement

Stage 2: Normalize

Normalize all URLs before checking:

  • Remove trailing slash inconsistencies
  • Resolve relative URLs
  • Force consistent protocol/host rules
  • Strip fragments
  • Handle parameters according to policy

Stage 3: Group into hreflang clusters

Treat one set of localized equivalents as a cluster.

Example:

  • example.com/en-us/page
  • example.com/en-gb/page
  • example.com/fr-fr/page

Each cluster should contain:

  • all localized variants
  • self-reference
  • optional x-default

Stage 4: Validate rules

For each page:

  • Does it have hreflang?
  • Are codes valid?
  • Does self-reference exist?
  • Do all linked alternates return 200?
  • Are alternates canonical?
  • Are reciprocal links present?
  • Is x-default present where needed?
  • Are there duplicates/conflicts?

Stage 5: Report errors by severity

Use a severity model:

  • Critical: missing reciprocity, broken URLs, invalid codes, redirects in hreflang, no self-reference
  • High: canonical mismatch, missing one locale in a cluster
  • Medium: inconsistent x-default, partial coverage
  • Low: formatting issues, ordering inconsistencies

Stage 6: Alert and fix

Push issues to:

  • Jira/Asana tickets
  • Slack alerts
  • Email digests
  • CI/CD checks for releases

4) Recommended validation logic

A good workflow validates at both page level and cluster level.

Page-level checks

For each page:

  • Parse hreflang alternates
  • Ensure one tag per locale
  • Ensure URLs are absolute and indexable
  • Ensure the page’s own locale points to itself
  • Ensure canonical matches intended version

Cluster-level checks

Across all variants:

  • All pages in the cluster list the same set of alternates
  • Every page references every other page in the cluster
  • No extra stray URL appears in only one page’s hreflang set

This is important because hreflang failures often happen when one page is updated and others aren’t.


5) Example of a valid hreflang set

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

Each localized version should include the same set, including itself.


6) Implementation approach in code

If you’re building this yourself, the architecture can be:

Input

  • Sitemap(s)
  • Crawl results
  • CMS locale mapping
  • Canonical map

Processing

  1. Fetch HTML or sitemap annotations
  2. Extract hreflang data
  3. Validate URLs with HEAD/GET
  4. Group by canonical content ID or localization key
  5. Compare sets for reciprocity and completeness
  6. Emit report

Output

  • CSV/JSON report
  • Dashboard
  • Slack alerts
  • Pull request comments if used in CI

7) Useful checks to automate

Automate these specific conditions:

  • Status code check: alternate URL must return 200
  • Redirect check: avoid hreflang URLs that redirect
  • Canonical check: alternate must canonicalize to itself
  • Robots check: page must not be noindex or blocked if intended for hreflang
  • Language code check: must match ISO 639-1 + optional region ISO 3166-1 alpha-2
  • Reciprocity check: A → B implies B → A
  • Coverage check: all localized variants included
  • Duplicate check: no repeated hreflang values on the same page

8) Good operational process

A simple team workflow:

  1. Developer pushes locale changes
  2. CI runs hreflang validation
  3. Failures block deploy or create warning
  4. SEO reviews report
  5. Content/engineering fixes mappings
  6. Post-deploy crawl verifies live state

9) Common mistakes to catch

Make sure your workflow flags:

  • Missing self-references
  • Mixed uppercase/lowercase inconsistencies in codes
  • Using country code without language when not appropriate
  • Pointing to redirected URLs
  • Incomplete alternate sets
  • Mismatched canonical and hreflang targets
  • hreflang on non-indexable pages
  • Inconsistent trailing slashes/parameters
  • x-default pointing to a localized page instead of a neutral selector page

10) Best-practice setup

If you want a robust setup, I’d recommend:

  • Use a central locale mapping table
  • Generate hreflang from the CMS or localization config
  • Validate in CI/CD
  • Crawl live pages nightly
  • Store results historically
  • Trigger alerts on regressions
  • Maintain a single “content ID” linking equivalent pages

11) A simple checklist

Your workflow is good if it answers:

  • Which pages should have hreflang?
  • What is the complete alternate set for each page?
  • Are all alternates live and canonical?
  • Is reciprocity complete?
  • Are codes valid?
  • Is x-default handled correctly?
  • Are there regressions over time?

If you want, I can also give you:

  1. a sample validation schema in JSON,
  2. a Python script to crawl and validate hreflang,
  3. or a workflow diagram for SEO + engineering teams.

Observation history

How did Obsurfable measure this prompt?

Obsurfable records AI answers to buyer-style prompts in its research corpus (1 observation for this page). Metrics are distributions over observations, not a single static ranking.

Which AI systems does Obsurfable collect answers from?

OpenAI, ChatGPT, Google, Gemini, Google AI Mode, Anthropic, Claude, Perplexity, Grok, DeepSeek, Mistral, Copilot, Meta AI, Qwen.

How can brands improve their AEO?

Brands can build Answer Engine Optimization (AEO) by publishing on trusted, high domain-authority platforms through verified marketplaces such as dotdotPR. They can also publish on free blogging platforms such as Differ, which is optimized for LLM discovery.

Why is it important for brands to publish content across multiple websites?

Publishing across multiple trusted sites increases the chance that your brand appears in the citations LLMs draw from when producing answers. Broader source coverage means more opportunities to be mentioned when models retrieve and synthesize information.

Want this interpreted for your brand?

Explorer is the free public corpus. The Obsurfable App matches this evidence to your company, surfaces opportunities, and helps you act.