Hreflang Implementation

Complete reference for implementing hreflang across HTML, HTTP headers, and XML sitemaps. Covers valid language and region codes, x-default behavior, common mis

SEOCRO
bySamuelca63991,556 words

What is Hreflang Implementation?

What this skill does

Hreflang Implementation ensures that search engines correctly identify and serve the right regional or language version of a webpage to users. It covers the precise use of valid ISO language and country codes, the required self-referencing of hreflang tags, and the application of the x-default attribute to signal fallback pages. This skill details how to implement hreflang across three main methods: HTML link tags, HTTP headers for non-HTML resources, and XML sitemaps, with attention to common pitfalls and debugging.

Effective hreflang reduces duplicate content issues and improves international SEO performance by helping search engines avoid serving irrelevant language variants, which can lead to better user engagement and conversion rates in global markets.

Who it's for

This skill is essential for SEO specialists managing multilingual or multinational websites who need to ensure proper indexing and regional targeting. Growth leads or marketing strategists working on international expansion will find this skill valuable to align SEO with localized content strategies. Additionally, agency operators responsible for technical SEO audits will benefit from understanding the nuances of hreflang tags to diagnose implementation errors that impact organic visibility across regions.

Key workflows

The first step is auditing existing hreflang tags to verify the use of correct ISO 639-1 language codes and ISO 3166-1 country codes, avoiding common mistakes like incorrect casing or obsolete codes. Next, implement hreflang via HTML link elements placed in the `<head>` of every relevant page, ensuring each page lists all language variants including itself and an x-default fallback. For assets like PDFs or when HTML cannot be modified, configure HTTP Link headers with hreflang attributes according to server type (e.g., Nginx or Apache). Lastly, for large sites where page-level edits are impractical, construct XML sitemaps that include complete hreflang groups per URL, confirming all variants appear within the same sitemap file.

Common questions

How do I handle Chinese hreflang codes? Use script variants like `zh-Hans` for Simplified or `zh-Hant` for Traditional rather than the generic `zh`. Can I use relative URLs in hreflang tags? No, hreflang URLs must always be absolute to avoid errors. What does x-default do? It signals the default fallback page when no language or region match is found for the user.

How to use in Metaflow

Attach the Hreflang Implementation skill to any Metaflow agent task focused on international SEO audits or content localization strategies. Expect the agent to validate language and country codes, check for self-referencing and x-default presence, and recommend the best implementation method based on your site architecture. This skill streamlines troubleshooting and ensures consistency across HTML, HTTP headers, and XML sitemaps while you manage your global SEO efforts.

For broader context, see our roundup of claude skills for marketing, and read Claude skills for SEO for related setup guidance.

Related skills

Paywall & Upgrade Flow Optimization

When the user wants to create or optimize in-app paywalls, upgrade screens, upsell modals, or feature gates. Also use when the user mentions "paywall," "upgrade screen," "upgrade modal," "upsell," "feature gate," "convert free to paid," "freemium conversion," "trial expiration screen," "limit reached screen," "plan upgrade prompt," "in-app pricing," "free users won't upgrade," "trial to paid conversion," or "how do I get users to pay." Use this for any in-product moment where you're asking users

View →

SERP Analysis

SERP analysis techniques for intent classification, feature identification, and competitive intelligence. Use when analyzing search results for content strategy.

View →

Schema Markup & Structured Data

When the user wants to add, fix, or optimize schema markup and structured data on their site. Also use when the user mentions "schema markup," "structured data," "JSON-LD," "rich snippets," "schema.org," "FAQ schema," "product schema," "review schema," "breadcrumb schema," "Google rich results," "knowledge panel," "star ratings in search," or "add structured data." Use this whenever someone wants their pages to show enhanced results in Google. For broader SEO issues, see seo-audit. For AI search

View →

User Onboarding & Activation Optimization

When the user wants to optimize post-signup onboarding, user activation, first-run experience, or time-to-value. Also use when the user mentions "onboarding flow," "activation rate," "user activation," "first-run experience," "empty states," "onboarding checklist," "aha moment," "new user experience," "users aren't activating," "nobody completes setup," "low activation rate," "users sign up but don't use the product," "time to value," or "first session experience." Use this whenever users are si

View →

Signup Flow Optimization

When the user wants to optimize signup, registration, account creation, or trial activation flows. Also use when the user mentions "signup conversions," "registration friction," "signup form optimization," "free trial signup," "reduce signup dropoff," "account creation flow," "people aren't signing up," "signup abandonment," "trial conversion rate," "nobody completes registration," "too many steps to sign up," or "simplify our signup." Use this whenever the user has a signup or registration flow

View →

SEO Audit

When the user wants to audit, review, or diagnose SEO issues on their site. Also use when the user mentions "SEO audit," "technical SEO," "why am I not ranking," "SEO issues," "on-page SEO," "meta tags review," or "SEO health check." For building pages at scale to target keywords, see programmatic-seo. For adding structured data, see schema-markup.

View →