seo-hreflang
Skill1 starsChanged 8 months agoMITView on GitHub
Hreflang and internationalization SEO rules. Use when working with locale routing, language switching, alternate language links, the /{lang}-{country}/ URL pattern, i18n configuration, or middleware locale detection.
25 other projects use a version of this.
Adopted by
Most recently taken up by
- joaoguirunas/team-ostheir own version, first seen Sep 26, 2026
- avalonreset/legends-seo-dungeontheir own version, first seen Sep 6, 2026
- gaznil/seo-skills-by-gazniltheir own version, first seen Aug 31, 2026
- Haniubub/seo-toolkittheir own version, first seen Aug 29, 2026
- asale-ai/seo-geo-skilltheir own version, first seen Aug 29, 2026
- Yass5002/agent-skillstheir own version, first seen Aug 27, 2026
Used with
Projects with it also use seo-google, seo-sxo and 8 more.
Other files people use alongside this one.
Files found in the same public projects as a version of this one, more often than they turn up anywhere else. Each project counts once, large collections count for less, and this file's own repository is left out.
amirjahfar1Skillseo-google
Direct access to Google's own SEO data via Search Console (Search Analytics, URL Inspection, Sitemaps), PageSpeed Insights v5, CrUX field data with 25-week history, Indexing API v3, GA4 organic traffic, YouTube video search, Google NLP entity/sentiment analysis, Knowledge Graph entity verification, Web Risk safety, and Google Ads Keyword Planner. Bridges crawl-based analysis (the rest of this catalogue) with Google's real-time field data — actual Chrome user metrics, real indexation status, real search performance, real organic traffic. Use when the user asks "search console", "GSC", "PageSpeed", "CrUX", "field data", "indexing API", "GA4 organic", "URL inspection", "google api setup", "real CWV data", "impressions", "clicks", "CTR", "position data", "LCP", "INP", "CLS", "FCP", "TTFB", "Lighthouse scores", "youtube SEO", "knowledge graph", "keyword planner", or "real google data".
Also in 11 projects that use this
amirjahfar1Skillseo-sxo
Diagnose why a page is not ranking by reading the SERP backwards. Identifies the page type Google rewards for the target keyword, scores the candidate page against that pattern from multiple persona perspectives, and recommends the page format that would win the SERP. Use when the user asks "why isn't this page ranking", "page type mismatch", "SXO", "search experience optimization", "intent mismatch", or wants a wireframe.
Also in 11 projects that use this
AgriciDanielSkillseo-image-gen
AI image generation for SEO assets: OG/social preview images, blog hero images, schema images, product photography, infographics. Powered by Gemini via nanobanana-mcp. Requires banana extension installed. Use when user says \"generate image\", \"OG image\", \"social preview\", \"hero image\", \"blog image\", \"product photo\", \"infographic\", \"seo image\", \"create visual\", \"image-gen\", \"favicon\", \"schema image\", \"pinterest pin\", \"generate visual\", \"banner\", or \"thumbnail\".
Also in 10 projects that use this
AgriciDanielSkillseo-flow
FLOW framework integration: evidence-led SEO using the Find → Leverage → Optimize → Win loop. Surfaces stage-specific AI prompts from the FLOW knowledge base (41 prompts, CC BY 4.0). Use when user says "FLOW", "FLOW framework", "seo flow", "evidence-led SEO", "find leverage optimize win", or wants stage-specific SEO prompts.
Also in 8 projects that use this
indranilbanerjeeSkillseo-drift
Compare two SEO snapshots from the same source — GSC, the GSC AI Performance report, a rank-tracker export, or aeo-audit probes — into a drift report: top gainers and losers per metric, growth/decline/reshuffle/stable/new/lost classification, and a four-gate quality scorecard. Triggers on \"/digital-marketing-pro:seo-drift\", \"compare this month's GSC export to last month's\", \"what moved after the core update\", \"did the content refresh work\", \"which queries lost AI Mode impressions\". Runs scripts/seo_drift.py on two CSVs, reads the brand profile for noise thresholds, and branches findings to /digital-marketing-pro:seo-audit, /digital-marketing-pro:aeo-geo, or /digital-marketing-pro:content-engine.
Also in 11 projects that use this
mangollcSkillseo-local
Local SEO optimization: Google Business Profile post generation, 30-day posting calendars, NAP consistency checks, local citation audits, review response templates, local keywords.
Also in 13 projects that use this
- +1 more from amirjahfar1
- +3 more from AgriciDaniel
Other versions25 projects use a version of this.
Word for word · 0
None found.
Edited · 0
None found.
Wrote their own version · 25
- AgriciDaniel/claude-seo★ 18ksame name
- seranking/seo-skills★ 155same name
- seoskillsai/seo-skills-ai★ 18same name
- coopersimson96/ai-content-system★ 17same name
- ZachArticulateV/designer-pro-and-seo★ 9same name
- Haniubub/seo-toolkit★ 7same name
- megastep/codex-skills★ 7same name
- asale-ai/seo-geo-skill★ 6same name
- mikiarlo3/enso-SEO-GEO★ 6same name
- 01clauding/claude-seo-skill★ 4same name
15 more not listed
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 repository11 other files it gives its agents.
- CLAUDE.mdCLAUDE.md
- .github/copilot-instructions.mdCopilot instructions
- seo-crawlabilitySkill
- seo-ecommerceSkill
- seo-imagesSkill
- seo-internal-linkingSkill
- seo-metadataSkill
- seo-performanceSkill
- seo-redirectsSkill
- seo-structured-dataSkill
- seo-urls-routingSkill
The file
We split this skill into the rules it gives an agent
2 rules. 0 are common, 0 are distinctive, and 2 are very specific to this project.
0
Common
Most of the 25 edited versions we read keep these.
0
Distinctive
This author's own choices. Worth a look.
2
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 15
Every indexable page MUST include <link rel="alternate" hreflang="xx-YY"> tags for ALL locale variants of that page, plus an x-default …
- Very specific: line 29
App Router: Use the alternates.languages field in generateMetadata.
“Common” is measured: kept by at least 6 in 10 of the 25 edited versions of this file we could read. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Hreflang & Internationalization SEO Guidelines
Technical rules for implementing locale routing and multi-language hreflang tags in a Next.js e-commerce site. These patterns apply to any multi-locale site — adapt the locale list to match your project's configuration.
For locale configuration patterns, see locale-matrix.md.
Hreflang Link Tags
Every indexable page MUST include <link rel="alternate" hreflang="xx-YY"> tags for ALL locale variants of that page, plus an x-default entry.
Rules
- All variants must be listed — if a page exists in N locales, there must be N+1 link tags (all locales + x-default)
- Self-referencing required — the current page's locale must be included in its own hreflang tags
- x-default — should point to the default/international locale as the fallback for unmatched users
- URLs must be absolute — full URL with protocol, domain, and locale prefix
- Bidirectional — if page A hreflang-links to page B, page B must hreflang-link back to page A
- Same content — hreflang links must connect equivalent pages (same product, same category), not different pages
- Hreflang value format — use lowercase language, uppercase country:
en-GB,de-DE,fr-FR(ISO 639-1 + ISO 3166-1 Alpha-2)
Implementation in Next.js
App Router: Use the alternates.languages field in generateMetadata. Pages Router: Render <link rel="alternate"> tags via next/head.
// Example imports — use your project's actual config
import { SITE_URL } from '@/config/site';
import { ALL_LOCALES, DEFAULT_LOCALE } from '@/config/locales';
export async function generateMetadata({ params }: Props): Promise<Metadata> {
const { locale, id, slug } = params;
const path = `/products/${id}/${slug}`; // adapt to your project's URL structure
// Build hreflang map dynamically from locale config
const languages: Record<string, string> = {
'x-default': `${SITE_URL}/${DEFAULT_LOCALE}${path}`,
};
for (const loc of ALL_LOCALES) {
languages[loc] = `${SITE_URL}/${loc}${path}`;
}
return {
alternates: {
canonical: `${SITE_URL}/${locale}${path}`,
languages,
},
};
}For the root layout (applies to all pages). In Pages Router, place this logic in _app.tsx or a shared layout component.
// Layout file (e.g. app/[locale]/layout.tsx or a shared layout component)
// Example imports — use your project's actual config
import { SITE_URL } from '@/config/site';
import { ALL_LOCALES, DEFAULT_LOCALE } from '@/config/locales';
export async function generateMetadata({ params }: Props): Promise<Metadata> {
const languages: Record<string, string> = {
'x-default': `${SITE_URL}/${DEFAULT_LOCALE}/`,
};
for (const loc of ALL_LOCALES) {
languages[loc] = `${SITE_URL}/${loc}/`;
}
return {
alternates: {
languages,
},
};
}Hreflang in Sitemaps (best practice)
In addition to HTML link tags, include hreflang in XML sitemaps using <xhtml:link>:
<url>
<loc>https://example.com/en-GB/products/123/blue-widget-pro</loc>
<xhtml:link rel="alternate" hreflang="en-GB" href="https://example.com/en-GB/products/123/blue-widget-pro"/>
<xhtml:link rel="alternate" hreflang="de-DE" href="https://example.com/de-DE/products/123/blue-widget-pro"/>
<xhtml:link rel="alternate" hreflang="x-default" href="https://example.com/en-US/products/123/blue-widget-pro"/>
<!-- ... all locales -->
</url>HTTP Header Method
For non-HTML resources (PDFs, downloadable files), use HTTP Link headers:
Link: <https://example.com/en-US/file.pdf>; rel="alternate"; hreflang="en-US",
<https://example.com/de-DE/file.pdf>; rel="alternate"; hreflang="de-DE",
<https://example.com/en-US/file.pdf>; rel="alternate"; hreflang="x-default"Google treats all three methods (HTML tags, HTTP headers, sitemaps) as equivalent signals. There is no benefit from combining multiple methods for the same page — pick whichever is most convenient.
Multi-Language Countries
Several countries have multiple language variants. All variants must cross-reference each other:
| Country | Locales |
| Switzerland | en-CH, de-CH, fr-CH, it-CH |
| Belgium | en-BE, nl-BE, fr-BE, de-BE |
| Canada | en-CA, fr-CA |
| Netherlands | en-NL, nl-NL |
All locale variants must be included in hreflang — do not only link within the same country. A German-speaking user in Switzerland (de-CH) should also see links to de-DE and de-BE.
Language Switcher Component
The language/country switcher in the UI must:
- Link to the same page in the target locale — not just the homepage of that locale
- Use
<Link>from next/link — enables client-side navigation - Preserve URL path — switching from
/en-GB/products/123/blue-widget-proto German should go to/de-DE/products/123/blue-widget-pro - Be visible and crawlable — search engines use the switcher to discover locale variants
Middleware Locale Detection
// middleware.ts
// Example imports — use your project's actual config
import { ALL_LOCALES, DEFAULT_LOCALE } from '@/config/locales';
export function middleware(request: NextRequest) {
const pathname = request.nextUrl.pathname;
// Check if pathname already has a locale prefix
const pathnameHasLocale = ALL_LOCALES.some(
locale => pathname.startsWith(`/${locale}/`) || pathname === `/${locale}`
);
if (!pathnameHasLocale) {
// Detect preferred locale from Accept-Language header
const locale = detectLocale(request) || DEFAULT_LOCALE;
// 302 redirect (temporary) — locale preference may change
return NextResponse.redirect(new URL(`/${locale}${pathname}`, request.url));
}
}Use 302 (temporary) for locale detection redirects — the user's preferred locale may change, so this should not be a permanent redirect.
Common Technical Anti-Patterns
- Missing self-referencing hreflang — the page must include itself in the hreflang set
- Missing x-default — always include x-default pointing to the default locale
- Language switcher links to locale homepage — must preserve the current page path
- One-directional hreflang — if en-GB links to de-DE, de-DE must link back to en-GB
- Hardcoded locale list — always derive from a single config source (e.g. a shared locale config array)
- 301 for locale detection — use 302 (temporary) for Accept-Language redirects
- Missing locales from hreflang — every locale the page is available in must be listed, or Google may not associate them
Why it matters: Incorrect hreflang causes search engines to show the wrong language version to users, or to treat locale variants as duplicate content. For a multi-locale site, this can massively dilute ranking signals.
Important caveat: Google treats hreflang as a hint, not a directive. Google may still choose a different locale version based on canonical tags, site structure, or content similarity. Correct implementation improves the odds of Google serving the right version, but does not guarantee it.
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.

