We are using cookies to give you the best experience on our website. Learn more.
Magento 2 Hreflang Extension
With the Hreflang Extension for Magento 2 you can direct search engines to alternative versions of your page in different languages or for different regions. Then the search results will show those versions of your pages that are the best suited to the language and region of the user.
x-default
, consist of a language code, or a language code and a region codeLocalized versions of the page for products, categories and CMS pages
In the configuration settings, you can choose on which specific types of pages you want to provide links to their alternative versions. Localized page variations can be added to the product page, category page, CMS page, and home page.
HTML tags for specifying localized versions of the page
The Hreflang Extension for Magento 2 adds <link rel="alternate" hreflang="lang_code" href="url_of_page" />
elements to the page header to inform search engines about all localized page variations.
Grouping of localized versions of a page at the website level or globally
If you have several websites, then, if necessary, you can link localized versions of a page within a separate website. In this case, in each resulting group of alternate page versions, you can select a link and use the hreflang attribute for it with the x-default
value.
You can also link localized versions of a page globally. In the resulting group of alternate page versions, you can also select the link and set the hreflang attribute to x-default
.
The values of the hreflang attribute
The hreflang attribute indicates the language and, optionally, the region of the alternate URL. The value of the hreflang attribute can also be x-default
for languages that are not specified in the page's hreflang attribute. The language code can be determined automatically from Store Locale or manually selected. The region code can be determined automatically from the Default Country for the store or manually selected.
Grouping of CMS pages
In the configuration settings, you can specify the attribute of the CMS page, by which you want to link the localized versions of the pages. You can link CMS pages by ID, URL Key, Hreflang Identifier (new attribute).
Localized versions of the page and Robots Meta Tag
Links to localized versions of the page are not added to a page whose Robots Meta Tag contains the NOINDEX directive.
Use Magento 2 Meta Robots Extension to configure Robots Meta Tag on your website pages.
Compatibility
Hreflang Extension for Magento 2 is compatible with Magento 2 Canonical URL Extension (recommended to use together), Magento 2 Meta Robots Extension.
For full SEO customization on your website, use the Magento 2 SEO Extension.