Powered by Adobe Commerce 2.4.9

icon_240x240.png

Hreflang Language Tags

PRODUCT:
0
TOTAL:

Trader Information

Back to top

Overview

Back to top

Mage2Expert Hreflang Language Tags is an extension for Magento 2 that automatically injects <link rel="alternate" hreflang="..."> tags into the <head> section of your store pages. These tags are a standard HTML mechanism defined by Google and Bing to help search engines understand which language or regional variant of a page to serve to visitors in different countries or speaking different languages. Without hreflang tags, a multi-store Magento installation can suffer from international duplicate-content issues: search engines may index only one version of a product page regardless of how many localised store views exist, or they may display the wrong language version to users in a particular region. This extension resolves that problem by generating accurate, standards-compliant alternate link tags for every active store view — automatically, on every page load, with no manual template edits required. The extension works natively with Magento's built-in URL Rewrite engine and requires no third-party libraries, cron jobs, or additional database tables.

Features

  • Automatic tag injection — hreflang <link rel="alternate"> tags are rendered inside the HTML <head> on every applicable page without requiring any template customisation or theme modifications.
  • Four page types supported — Product pages, Category pages, CMS pages, and the Homepage can each be enabled or disabled independently from the admin panel.
  • x-default tag support — designate a specific store view as the x-default fallback for users whose language or region is not explicitly listed. If no store is designated, the extension falls back to the first active store view automatically.
  • Per-store-view language codes — assign any valid BCP 47 language tag to each store view (e.g. en, en-US, en-GB, fr-FR, de-DE, zh-Hans-CN, zh-Hant-TW). Store views with an empty language code are silently excluded from hreflang output — useful for internal or staging store views.
  • URL rewrite resolution — for product and category pages, the extension queries Magento's url_rewrite table to find the localised URL path for each store view. Translated URL keys (e.g. joust-duffle-bag.html in English, sac-de-sport.html in French) are resolved and used correctly without any extra configuration.
  • Homepage handling — for the homepage, each store view's configured base URL is used directly, eliminating the need for URL rewrite lookups on the root path.
  • Multi-website and multi-store-group compatible — works with any Magento store tree configuration including multiple websites, multiple store groups, and multiple store views.
  • Request-level caching — hreflang data is computed once per request and cached in memory. Repeated calls within the same request have no additional database overhead.
  • Full-page cache compatible — hreflang tags are part of the rendered page HTML and are cached by Magento's built-in full-page cache and Varnish.
  • Scope-aware configuration — all settings support Default, Website, and Store View scopes, giving fine-grained control over which page types and store views participate in hreflang output.
  • Zero core modifications — all functionality is implemented through Magento's layout XML and Block architecture. No core files are overridden.
  • Zero runtime dependencies — no third-party PHP libraries are required beyond the Magento 2 framework itself.

How It Works

When a page is loaded, the extension's Block class runs the following sequence. First, if the module is disabled in configuration, the Block returns immediately and no tags are output. Next, the current Magento request action name is inspected: supported actions are cms_index_index (homepage), catalog_product_view (product page), catalog_category_view (category page), and cms_page_view (CMS page). If the action is not one of these, or if the corresponding page type is disabled, the Block exits early. All active Magento store views are then collected — if fewer than two are active, hreflang tags serve no purpose and none are generated. 

For non-homepage pages, the extension reads the browser-facing URL path from the request and looks it up in the url_rewrite table for the current store view to obtain the entity type and entity ID. For each active store view, it queries the url_rewrite table for a rewrite matching the resolved entity type and entity ID. The store view's base URL is combined with the retrieved request path to produce the alternate URL. Store views for which no URL rewrite exists for the entity are omitted from the output. A leading x-default entry is added using the configured or auto-selected store view URL. The Phtml template then outputs one <link rel="alternate" hreflang="..."> tag per entry inside the page <head>

Admin Configuration

All settings are located under Stores → Configuration → Mage2Expert → HrefLang Tags and can be configured at the default, website, or store-view level. 

  • Enable HrefLang Tags (Yes / No) — master switch for the entire feature set.
  • X-Default Store View (dropdown) — selects which active store view's URL is used for the x-default hreflang entry. Available at Default and Website scope. If set to None, the first active store view is used automatically.
  • Enable for Product Pages (Yes / No) — controls hreflang output on catalog_product_view pages.
  • Enable for Category Pages (Yes / No) — controls hreflang output on catalog_category_view pages.
  • Enable for CMS Pages (Yes / No) — controls hreflang output on cms_page_view pages, excluding the homepage.
  • Enable for Homepage (Yes / No) — controls hreflang output on the CMS homepage (cms_index_index).
  • Language Code (hreflang) (text, per store view) — the BCP 47 language tag for the selected store view. Must be configured individually for each store view using the scope selector. Leave empty to exclude a store view from hreflang output.

Technical Specifications

Back to top

Seller profile

Sukumar Gorai

Seller contact

E-mail

Current Version

1.0.0

Adobe Commerce platform compatibility

Adobe Commerce (cloud): 2.4 (current)

Adobe Commerce (on-prem): 2.4 (current)

Magento Open Source: 2.4 (current)

Type

Stable Build

Updated

26 June, 2026

Categories

Extensions, Marketing, SEO/SEM

Documentation

User Guides

License Type

Open Software License 3.0 (OSL-3.0)

Policy

Privacy Policy

Quality Report

Back to top

Installation & Varnish Tests

Passed

Coding Standard

Passed

Plagiarism Check

Passed

Malware Check

Passed

Marketing Review

Passed

Manual Testing

Passed

All tests were conducted on the latest versions of Adobe Commerce that existed for the compatible release lines at the moment of the extension submission. Latest versions of all other software were used, as applicable.

Release Notes

Back to top

1.0.0:

  • Compatible with Adobe Commerce (cloud) : 2.4
  • Compatible with Adobe Commerce (on-prem) : 2.4
  • Compatible with Magento Open Source : 2.4
  • Stability: Stable Build
  • Description:

    Initial release — automatic hreflang tag injection for product, category, CMS, and homepage page types; configurable x-default store view; per-store-view BCP 47 language codes; URL rewrite resolution for localised URL keys; multi-website and multi-store-group support; full Magento 2.4.x and PHP 8.1–8.4 compatibility.

Support

Back to top

The best place to start if you need help with a specific extension is to contact the developer. All Adobe Commerce developers have both a contact email and a support email listed.

Contact Vendor

Q & A

Back to top

Reviews

Back to top