HOW TO

How to Implement Hreflang

22-Minute Expert Guide by Jason Langella

Complete guide to implementing hreflang for international SEO success.

Jason Langella
Founder & Chairman
January 11, 2025
22 min read
How to Implement Hreflang

Definition

Hreflang is an HTML attribute that tells search engines which language and regional versions of pages to show different users - essential for international SEO to prevent duplicate content issues across multi-language sites.

Understanding Hreflang Implementation

For comprehensive technical optimization strategies, explore our complete Technical SEO Audit guide. Hreflang annotations help search engines understand the relationship between different language version and regional versions of your content. Each hreflang tag tells search engines which page targets a specific language and region combination. Proper implementation ensures users see the appropriate alternate version for their language and location, improving user experience and preventing duplicate content issues across international seo sites. Every alternate URL should reference a self-referential rel canonical tag, and each xhtml link rel alternate hreflang en href https annotation must point to a fully-qualified, indexable URL. To target UK English, for example, you add an alternate hreflang en gb annotation whose hreflang en gb href value uses an absolute en gb href https address so search engines resolve the British version without ambiguity.

When You Need Hreflang

Hreflang is appropriate when you have: - The same content translated into multiple languages - Region-specific versions of content (UK vs US English) - Combined language and regional targeting

You do not need hreflang for: - Single-language, single-country sites - Different products for different countries - Completely different content between regions

Hreflang Syntax and Values

Understanding correct syntax prevents implementation errors.

Basic Syntax

The hreflang attribute uses ISO language and optional country codes in a link rel alternate hreflang pattern: ```html ```

Language Codes

Use ISO 639-1 two-letter language codes for each version of the page: - en (English - used for every english version) - es (Spanish) - fr (French) - de (German) - zh (Chinese)

Region Codes

Optionally add ISO 3166-1 Alpha-2 country codes to distinguish between english speaking regions or other regional variants: - en-US (English for United States - the english page for US users) - en-GB (English for United Kingdom) - es-MX (Spanish for Mexico) - zh-CN (Chinese for China)

X-Default Value

The x-default value indicates a fallback or language selector page: ```html ```

Use x-default for: - Pages that detect user language - Language selection pages - Default version when no other match exists

Implementation Methods

Three methods exist for implementing hreflang.

HTML Link Elements (Head Section)

Add hreflang annotations to the head section of each page: ```html ```

HTTP Headers

For non-HTML files (PDFs, etc.), use http headers to declare hreflang annotations: ``` Link: ; rel="alternate"; hreflang="en", ; rel="alternate"; hreflang="es" ```

XML Sitemap

Include hreflang in your xml sitemap for large-scale international seo deployments: ```xml https://example.com/page/ ```

Critical Implementation Rules

Hreflang requires specific rules for proper function.

Reciprocal Linking

Every page must reference all alternates, including itself: - Page A must link to A, B, and C - Page B must link to A, B, and C - Page C must link to A, B, and C

Missing reciprocal links cause hreflang to be ignored.

Self-Referencing

Each page must include itself in hreflang: ```html ```

Canonical Consistency

Hreflang URLs should match canonical URLs: - Do not hreflang to non-canonical versions - Canonical and hreflang should point to same URL - Avoid conflicts between these signals

Absolute URLs

Always use absolute URLs with protocol: ```html

```

Common Implementation Patterns

Different site structures require different approaches.

Subdirectory Structure

For sites using subdirectories by language: ``` example.com/ (English) example.com/es/ (Spanish) example.com/fr/ (French) ```

Subdomain Structure

For sites using subdomains: ``` en.example.com (English) es.example.com (Spanish) fr.example.com (French) ```

ccTLD Structure

For country-code top-level domains: ``` example.com (US) example.co.uk (UK) example.de (Germany) ```

How to Implement Hreflang on WordPress

WordPress is the most common CMS for international sites, and several approaches exist to implement hreflang correctly depending on your multilingual plugin choice.

Using WPML (WordPress Multilingual Plugin): WPML automatically generates hreflang annotations in the HTML head section for all translated pages. After installing WPML and configuring your language settings, the plugin handles reciprocal linking, self-referencing, and x-default annotations automatically. Verify the output by viewing page source and searching for "hreflang" - WPML occasionally generates incorrect annotations when posts are only partially translated. In WPML Settings > Languages, ensure "SEO" options have hreflang enabled and set your default language as the x-default target.

Using Polylang: Polylang generates hreflang annotations natively when languages are properly configured. Navigate to Languages > Settings > URL modifications and select your preferred URL structure (subdirectory is recommended for most sites). Polylang inserts hreflang link elements in the head section automatically. One common issue: Polylang does not add x-default by default - install the "Polylang Hreflang" add-on or add x-default manually via the wp_head hook.

Manual WordPress implementation: For sites without multilingual plugins, add hreflang via the wp_head action hook in your theme's functions.php file. This approach requires maintaining a mapping array of page IDs to their language variants and generating the appropriate link elements programmatically. While more complex, it provides maximum control over the output.

How to Implement Hreflang on Shopify

Shopify's native international features (Shopify Markets) handle hreflang automatically when you configure market-specific domains or subfolders. When using Shopify Markets with subfolders (e.g., /en-gb/, /fr/), the platform generates hreflang annotations in the HTML head section for all published pages across active markets.

Key configuration steps for Shopify: 1. Navigate to Settings > Markets and create markets for each target country/language 2. Assign subfolders or domains to each market 3. Translate content using Shopify Translate & Adapt app or a third-party translation app 4. Verify hreflang output by viewing page source on product, collection, and content pages

Common Shopify hreflang issues: Shopify generates hreflang only for pages that exist in both markets. If a product is not available in a specific market, no hreflang annotation is generated - which is correct behavior. However, if you unpublish a product in one market without removing the translation, orphaned hreflang references can persist temporarily. Monitor via Google Search Console's International Targeting report.

For sites with 1,000+ pages in multiple languages, XML sitemap implementation is the most scalable approach to implement hreflang because it centralizes all annotations in one location rather than distributing them across every HTML page.

Step-by-step XML sitemap hreflang implementation:

  1. Create a dedicated sitemap file (e.g., sitemap-hreflang.xml) or add hreflang to your existing sitemap
  2. Add the xhtml namespace declaration to the urlset element: xmlns:xhtml="http://www.w3.org/1999/xhtml"
  3. For each URL, include xhtml:link elements for every language version including the self-referencing annotation
  4. Submit the sitemap to Google Search Console and Bing Webmaster Tools
  5. Validate the sitemap using an XML validator before submission

Performance consideration: For sites with 10 languages and 10,000 pages, the hreflang sitemap will contain 100,000 xhtml:link elements. Split large sitemaps into multiple files (max 50MB or 50,000 URLs per file) and reference them from a sitemap index file.

Debugging and Validation Tools for Hreflang

Implementing hreflang is only half the work - validating the implementation is equally critical. Most international websites carry at least one hreflang implementation error that degrades search performance, and those errors are invisible until you validate the markup directly.

Free debugging tools: - Google Search Console International Targeting report: Shows hreflang errors detected during crawling, including missing return links and invalid language codes. Check this report weekly after any hreflang changes. - Hreflang Tags Checker (technicalseo.com): Validates individual URLs for correct hreflang implementation, checking reciprocal links, self-referencing, and language code validity. - Aleyda Solis Hreflang Tags Generator: Free tool that generates correct hreflang markup from your URL and language inputs - useful for building templates before scaling. - Screaming Frog hreflang tab: Crawl your entire site and export all hreflang annotations in a spreadsheet. Filter for missing reciprocal links, invalid codes, and pages with inconsistent hreflang counts.

Paid debugging tools: - Sitebulb: Provides visual hreflang cluster maps showing relationships between language versions, making it easy to spot broken or incomplete clusters. - DeepCrawl (Lumar): Enterprise-scale hreflang validation with automated alerting when new errors are introduced during content publishing. - ContentKing (now part of Conductor): Real-time monitoring that detects hreflang changes as they happen - critical for sites with frequent content updates across multiple language versions.

Debugging workflow for hreflang issues: 1. Run a full site crawl in Screaming Frog with "Hreflang" tab enabled 2. Export hreflang data and filter for rows where "Number of Hreflang" values differ across language versions (indicates missing reciprocal links) 3. Check Google Search Console International Targeting for specific error types 4. Use URL Inspection tool on flagged pages to verify Google's interpretation of your hreflang 5. Fix issues starting with highest-traffic pages first 6. Resubmit affected sitemaps and monitor for 30 days

Common Country and Language Code Reference

Incorrect ISO codes are one of the most common hreflang implementation failures. Here are the codes most frequently needed and most frequently confused:

Frequently confused codes: - United Kingdom: use "en-GB" (NOT "en-UK" - this is the most common error) - Brazil: use "pt-BR" (NOT "pt-BZ" which is Belize) - China (Simplified): use "zh-Hans" or "zh-CN" - China (Traditional/Taiwan): use "zh-Hant" or "zh-TW" - Latin America (Spanish): use "es-419" for all Latin American Spanish or specify individual countries (es-MX, es-AR, es-CO)

Complete list of commonly used hreflang values:
- es (Spanish, unspecified)es-ESes-MXes-ARes-COes-419
- fr (French, unspecified)fr-FRfr-CAfr-BEfr-CH
- de (German, unspecified)de-DEde-ATde-CH
- pt (Portuguese, unspecified)pt-BRpt-PT
- ja (Japanese)ko (Korean)zh-CNzh-TW
- ar (Arabic)hi (Hindi)ru (Russian)it (Italian)nl (Dutch)

Hreflang and Other International SEO Signals

Hreflang does not operate in isolation - it works alongside other technical and content signals that collectively determine how search engines serve international content.

Geotargeting in Search Console: For gTLD sites (e.g., .com, .net) using subdirectory or subdomain structures, set geographic targeting in Google Search Console's International Targeting settings. Note that ccTLDs (.co.uk, .de, .fr) are automatically associated with their country and cannot be retargeted. Geotargeting and hreflang should be aligned - do not target a subdirectory to France in GSC while using hreflang="fr-CA" on the same pages.

Content Localization Quality: Hreflang assumes content has been genuinely localized - not just machine-translated. Google has stated that hreflang annotations on poorly translated content may be ignored entirely. Invest in professional translation or, at minimum, human review of machine translations before applying hreflang annotations. Cultural adaptation goes beyond language: currency formatting, date formats, measurement units, local regulations, and cultural references all signal authentic localization.

User Experience Signals

User behavior affects effectiveness: - Ensure users can navigate between versions - Provide clear language selection - Remember user preferences - Avoid aggressive redirects

How AI Search Engines Interpret International Signals

Modern AI-powered search engines evaluate international configuration signals when determining which version of content to serve global users. Understanding how AI systems interpret hreflang helps optimize for both traditional and AI-driven discovery.

AI Citation Patterns for Global Content

AI systems prioritize geographically relevant sources when generating responses for international queries:

Localization Authority Signals: - Correct hreflang implementation indicates technical sophistication - Region-specific content demonstrates local relevance - Cultural adaptation signals genuine market understanding - Local entity references (currency, measurements, local offices) build trust - Consistent language usage across interface and content

Content demonstrating these signals receives substantially higher AI citation rates for queries originating from specific regions compared to generic international pages.

Voice Search and Language Targeting

Voice assistants rely heavily on language and region signals to deliver appropriate answers:

  • "Best SEO agency near me"
  • "How to do international SEO in Germany"
  • "Hreflang implementation guide for UK sites"
  • "SEO services pricing in Euros"

Optimizing technical signals like hreflang ensures voice assistants can confidently select the correct regional version of your content to answer user queries in their specific language and location context.

Entity Authority and Knowledge Graphs

AI systems build international entity understanding through consistent signals:

Global Entity Signals: - Consistent NAP data across regional offices - Local schema markup implementation - Regional social profiles linked to specific language versions - Local industry associations and certifications - Region-specific author attribution

Organizations investing in clear international entity signals gain favorable treatment in AI-synthesized recommendations for global users.

Industry-Specific Hreflang Strategies

Different industries require tailored international SEO approaches.

E-Commerce International SEO

E-commerce sites require precise product and currency targeting: - Product availability variations by region - Currency and pricing localization - Shipping and tax information adaptation - Local payment method integration - Seasonal promotion variations

SaaS International Strategy

SaaS companies balance global product with local marketing: - Feature availability variations - Pricing tier adaptation - Case studies from local markets - Support documentation localization - Compliance and data residency signaling

Travel and Hospitality SEO

Travel sites manage complex location and language matrices: - Destination content in multiple languages - Local booking engine integration - Cultural adaptation of descriptive content - Seasonal targeting variations by origin market - Reviews in native languages

The Future of International SEO

AI-Driven Translation and Localization

AI tools increasingly support content localization: - Neural machine translation with human review - Cultural adaptation assistance - Automated hreflang generation and validation - Predictive market opportunity analysis - Real-time personalization based on location

While AI assists, genuine cultural understanding remains irreplaceable. The most effective international strategies leverage AI tools while ensuring human cultural relevance.

Beyond Hreflang

International seo signals continue evolving: - HTTP headers for non-HTML content - Schema markup for language/region definition - Browser language detection signals - User interaction pattern analysis - Content delivery network (CDN) edge logic

Successful international SEO maintains technical excellence with hreflang - ensuring each page targets the correct audience via proper link rel alternate hreflang markup - while building broader localization signals that serve users and search engines alike.

Common Hreflang Implementation Failures and Recovery

Organizations frequently encounter hreflang implementation problems that silently degrade international search performance. Understanding common failure patterns enables proactive prevention and rapid recovery.

Incomplete Bidirectional References: Every hreflang relationship must be reciprocal - if page A declares page B as an alternate, page B must declare page A. Incomplete references cause search engines to ignore all hreflang annotations for affected page sets. Automated validation tools like hreflang.org's checker identify missing reciprocal references across large sites efficiently.

Incorrect Language-Region Combinations: Using invalid ISO codes - such as "en-UK" instead of "en-GB" or "zh-CN" instead of the correct lowercase "zh-cn" - silently invalidates annotations. A significant share of hreflang implementations contain at least one invalid code, making systematic validation essential.

Self-Referencing Omission: Each page must include a self-referencing hreflang annotation alongside references to alternate versions. Missing self-references create ambiguity about the current page's language-region targeting. This seemingly minor omission causes disproportionate interpretation failures in large-scale implementations.

X-Default Misapplication: The x-default annotation should point to the page served when no other hreflang annotation matches the user's language-region combination - typically a language selector page or the primary English version. Pointing x-default to a redirect or a non-existent page creates failed fallback experiences that degrade user trust and crawl efficiency.

Recovery Protocol: When hreflang issues are identified, implement fixes systematically. Audit all language-region pairs for bidirectional completeness. Validate ISO codes against the official registry. Confirm self-referencing on every page. Test x-default behavior from multiple geographic locations. Monitor Search Console's International Targeting report for at least 30 days post-fix to confirm resolution.

Ready to Master International SEO?

Proper hreflang implementation ensures international users find the appropriate version of your content, improving their experience while sending clear signals to search engines about your site structure and targeting intent. The technical foundation, validation processes, and strategic considerations we've outlined create the framework for global search success.

Contact our technical SEO team to audit your international configuration and develop a strategy that ensures your content reaches the right audience in every market.

When you implement hreflang for the english version of any product page, the canonical pattern in the head looks like link rel alternate hreflang en us href https://example.com/en-us/page paired with the equivalent annotations for every other locale. Validate the full set of link rel alternate hreflang en us href https declarations bidirectionally so search engines never have to guess which english version to serve to which audience.

Technical SEO vs Content SEO Priorities
FactorTechnical SEOContent SEO
Focus AreaInfrastructure & crawlabilityQuality & relevance
Key ActionsSpeed, schema, indexingTopics, keywords, E-E-A-T
Time InvestmentInitial setup, ongoing maintenanceContinuous creation
Impact SpeedQuick wins possibleGradual authority building
Expertise NeededDeveloper skills helpfulWriting & research skills
Jason Langella
Written by

Jason Langella

🏆2025 FMEA Associate Member of the Year

Founder & Chairman of SEO Agency USA, quoted in Forbes and Salesforce. 2025 FMEA Associate Member of the Year and board member for 3 technology companies. With 15+ years of experience, Jason is an active participant in the global tech community, including Google Cloud Next.

Share:

What Are the Key Takeaways from This Article?

Learn how to implement hreflang correctly - from the link rel alternate hreflang syntax for English versions to XML sitemap implementation for large international sites. Step-by-step guides for WordPress, Shopify, and enterprise CMS platforms with debugging tools and common mistake prevention.

Frequently Asked Questions

Common questions about this topic.

Start by auditing your current approach against the strategies outlined above. Identify gaps, prioritize quick wins, and build a phased implementation plan. For personalized guidance, schedule a consultation with our team.

As search engines and AI systems evolve, staying ahead requires understanding current best practices. The strategies in this article reflect the latest algorithmic signals and user behavior patterns that drive organic visibility.

Technical SEO ensures search engines can efficiently crawl, understand, and index your website. SEO Agency USA prioritizes technical SEO because it covers site speed, mobile optimization, structured data, XML sitemaps, and crawlability. Without a solid technical foundation, even great content may not rank because search engines cannot properly access it.

Core Web Vitals measure loading performance, interactivity, and visual stability. Google uses these as ranking factors, especially for mobile search. SEO Agency USA's technical audits identify CWV issues because poor scores can suppress rankings and increase bounce rates. Improving them often provides quick wins for both SEO and user experience.

Crawl budget is the number of pages search engines will crawl on your site within a timeframe. For sites under 10,000 pages, it rarely matters. For larger sites, poor crawl budget management can prevent important pages from being indexed. We optimize crawl efficiency for enterprise sites.

We use enterprise-grade crawling tools to analyze 200+ technical factors including site architecture, internal linking, page speed, mobile usability, structured data, and indexation status. We prioritize issues by impact and effort, providing actionable recommendations with clear implementation guidance.

To improve your local SEO, start by claiming and optimizing your Google Business Profile with accurate business information, photos, and regular posts. SEO Agency USA recommends ensuring your name, address, and phone number are consistent across all online directories. Encourage customer reviews and respond to them promptly. Create location-specific content on your website and build local citations.

The best SEO company for your business depends on your industry, budget, and goals. SEO Agency USA recommends looking for agencies with proven experience in your sector, transparent pricing, and documented case studies. Ask about their approach to reporting, communication frequency, and whether they offer customized strategies. SEO Agency USA serves enterprise and mid-market clients nationwide.

To rank higher on Google, SEO Agency USA recommends focusing on creating high-quality content that answers user questions, optimizing your website for speed and mobile devices, building authoritative backlinks, ensuring technical SEO fundamentals are solid, and maintaining consistent activity on Google Business Profile for local searches. SEO is a long-term strategy that compounds over time.

AI visibility refers to how often your brand appears in AI-generated answers from tools like ChatGPT, Perplexity, and Google AI Overviews. SEO Agency USA specializes in AI Visibility Optimization (GEO) because as more users get information from AI instead of traditional search, brands need to optimize their content to be cited by these systems. This requires structured content, authoritative sourcing, and entity optimization.

To appear in local search results, SEO Agency USA recommends optimizing your Google Business Profile with accurate location data, selecting relevant business categories, and maintaining consistent NAP information across all directories. Create location-specific landing pages, earn local reviews, and ensure your website is mobile-friendly. Proximity, relevance, and prominence are the key ranking factors.

Pricing is set by scope rather than by a rate card. The variables that move it are competitive difficulty, the size of your site and its technical debt, the number of markets or locations in play, content volume, and whether AI visibility work runs alongside organic search. SEO Agency USA builds a proposal against your goals, competitive landscape, and growth objectives, structured as a strategic partnership with documented ROI expectations. Request a Scope for pricing modeled on your requirements.

Get Expert Help With Your Strategy

Our team can help you implement these strategies and accelerate your growth.

Schedule a Free Consultation

Related Services

Explore our services related to this topic.

Ready to Accelerate Your Growth?

Let's discuss how we can apply these strategies to your business.

Schedule a Consultation