Complete reference for implementing hreflang across HTML, HTTP headers, and XML sitemaps. Covers valid language and region codes, x-default behavior, common mis
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.
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.
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.
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.
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.