MAHMOUD ABDELNABY
Seo · CLI SCRIPT · 2

Bilingual Hreflang Configuration Linter for MENA Domains

Catch hreflang return errors, wrong regional ISO codes, and currency mismatches across your Arabic and English domains.

Problem it addresses

Build a Python CLI (hreflang_validator.py) that audits bilingual Arabic/English XML sitemaps: 1) Validates language and country codes against official ISO 639-1 and ISO 3166-1 registries (strictly rejecting non-existent codes like zz-xx), 2) Enforces reciprocal bidirectional return links across URLs, 3) Treats x-default as an optional fallback in full alignment with official Google Search Central guidelines, 4) Generates structured JSON audit reports.

Who it is for

PRO operating in high-growth e-commerce, digital publishing, and direct-response marketing across Saudi Arabia, UAE, and Egypt.

What is inside

Key files listed in the README repository architecture:

  • data/mena_iso_locales.json
  • examples/audit_output.json
  • examples/sample_sitemap.xml
  • LICENSE
  • README.md
  • src/hreflang_validator.py
  • tests/test_validator.py

How to evaluate and use it

  1. Read the README first and confirm that the documented problem matches your use case.
  2. Inspect the listed files to find the data, tools, templates, and tests relevant to your task.
  3. Follow the repository’s Quick Start and check prerequisites before running commands.
  4. Compare outputs with documented examples and review limitations before using them in a decision or client workflow.

Quick Start from the README: python -m unittest discover -s tests · python src/hreflang_validator.py --sitemap examples/sample_sitemap.xml

Scope and limitations

  • Official ISO Code Verification: Codes must strictly exist in the official ISO 639-1 (language) and ISO 3166-1 alpha-2 (country) registries. Formats matching regex ^[a-z]{2}-[a-z]{2}$ but with fake entries (e.g. zz-xx) are flagged as fatal errors.
  • Hreflang Reciprocal Confirmation: If Page A links to Page B via an alternate hreflang annotation, Page B must link back to Page A; missing return links cause search engines to disregard annotations.
  • Optional x-default: In accordance with Google Search Central guidelines, x-default is recommended for unmatched landing pages, but its absence is never flagged as an error.

This page summarizes the available documentation; it does not establish performance or business results. Verify data and prerequisites before use.

Related repositories