hreflang-check
Skill0 starsChanged 13 days agoMITView on GitHub
Audit and fix hreflang annotations for multilingual or multi-regional sites - validates language, script and region codes, absolute URLs, self-references, reciprocal return links, x-default, duplicate codes, canonical conflicts and html lang mismatches - from an HTML build, an XML sitemap with xhtml:link entries, or a CSV export, and generates correct annotation sets. Use when the user works on international SEO, translations or country sites, sees "no return tags" or wrong-language pages ranking, or asks to add or validate hreflang.
2 other projects use a version of this.
Adopted by
Most recently taken up by
- teachskillofskills-ai/DigitalMarketingPro-techshutheir own version, first seen Oct 11, 2026
- indranilbanerjee/digital-marketing-protheir own version, first seen Feb 12, 2026
Other versions2 projects use a version of this.
Word for word · 0
None found.
Edited · 0
None found.
Wrote their own version · 2
- indranilbanerjee/digital-marketing-pro★ 934same name
- teachskillofskills-ai/DigitalMarketingPro-techshu★ 0same name
How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.
In this repository9 other files it gives its agents.
- AGENTS.mdAGENTS.md
- content-briefSkill
- core-web-vitals-triageSkill
- llms-txtSkill
- on-page-seo-reviewSkill
- redirect-mapSkill
- robots-sitemap-checkSkill
- schema-markupSkill
- technical-seo-auditSkill
The file
We split this skill into the rules it gives an agent
2 rules. About 0 are common, 1 is distinctive, and 1 is very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈1
Distinctive · estimate
This author's own choices. Worth a look.
1
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 39
Language only vs language-region: Use en, de when content differs by language only.
- Distinctive: line 42
Partial translations: Only list versions that exist.
≈ “Common” is an estimate: at least 1 in 5 of the 408,460 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
hreflang check
Make every language/region version of a page point at all the others (and itself) with valid codes, so search engines show the right version to each user.
Paths below are relative to this skill's directory.
When to use
- Adding hreflang to a site with translations or country versions
- "Wrong country/language version ranks", "No return tags" or "Unknown language code" reports
- Reviewing i18n routing in Next.js, Nuxt, Astro, Hugo, WordPress (WPML/Polylang), Shopify Markets
When not to use
- A single-language site: hreflang is unnecessary (an
<html lang>attribute is enough). - General canonical problems:
technical-seo-audit.
Workflow
- Find where hreflang is produced -
<link rel="alternate" hreflang>in the head template,xhtml:linkentries in the sitemap generator, or HTTPLink:headers (for PDFs). Use one method per page set; mixing makes conflicts likely. - Run the audit on whatever you have:
- Built HTML:
python3 scripts/hreflang_check.py --html-dir dist --base-url https://example.com [--clean-urls] --json - Sitemap:
python3 scripts/hreflang_check.py --sitemap sitemap.xml --json - Crawl export (one row per annotation):
python3 scripts/hreflang_check.py --csv hreflang.csv --jsonwith columnsurl,hreflang,href - Single codes:
python3 scripts/hreflang_check.py --code en-UK --code pt-BR
- Built HTML:
- Fix in this order: invalid codes -> relative or wrong URLs -> missing return links -> non-canonical targets -> missing self-references -> x-default -> html lang mismatches.
- Generate annotations from one shared mapping (a locale table or the CMS translation links), so every page in a cluster emits the identical set. See references/hreflang-rules.md for code rules and framework notes.
- Re-run until there are no errors; add the command to CI against the build output.
Decision points
- Language only vs language-region. Use
en,dewhen content differs by language only. Add a region (en-GB,en-US) only when content really differs (prices, spelling, legal). A region-only code likeGBis invalid. - x-default. Point it at the language selector or the global/fallback version. Recommended, not required.
- Canonicals. Each language version is self-canonical. Never canonicalise translations to one "main" language; that cancels hreflang.
- Partial translations. Only list versions that exist. Do not point a code at the homepage of that language as a fallback.
- Codes are case-insensitive, but write them conventionally:
en-GB,zh-Hant,pt-BR. - Common wrong codes:
en-UK(useen-GB),jp(useja),cn(usezh),es-419(Latin America is not supported by Google; list countries), underscores (en_US).
Output
## hreflang audit - <site> (<pages> pages, <annotated> annotated)
| Severity | Page | Issue | Fix |
## Corrected annotation set (example cluster)
<link rel="alternate" hreflang="en" href="https://example.com/" />
<link rel="alternate" hreflang="de" href="https://example.com/de/" />
<link rel="alternate" hreflang="x-default" href="https://example.com/" />
## Code changes
<the template / sitemap config / locale mapping change>Files
scripts/hreflang_check.py- offline audit (--html-dir,--sitemap,--csv,--code,--strict,--json).- references/hreflang-rules.md - code format, implementation methods, framework notes.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

