Skip to main content

How to configure alternate and hreflang

This page describes how to configure alternate tags and hreflang links.

tip

After saving the configuration, clear the Magento cache to apply changes.


Automatic generation

Alternate links and hreflang tags can be generated automatically by choosing Enabled for all websites in Enable alternate and hreflang links configuration located in Marketing -> Settings -> Alternate and hreflang settings under the necessary website scope.

If you have a multilingual store, you need to configure a second hreflang parameter (the language part of the country/language pair) for store views that require it.

To set the appropriate language for a store view, go to Stores -> Configuration -> General, and select the required store view. In the Locale options tab, choose the appropriate locale for this store view and save the changes. The selected locale code will be used as the first part of the hreflang parameter.

Optionally, you can specify a language code that will be added to the alternate URL as the second parameter.
Go to Marketing -> Settings and select the store view where another language is used. Uncheck Use website for the option Enable alternate and hreflang links, and from the drop-down menu, select Enabled for all websites. After this, a new field will appear: Hreflang locale code.

Manual adjustment

Alternatively, you can set the Enable alternate and hreflang links option to Configure. This allows you to manually specify which store views are alternate versions of each other by placing them in the same store group and individually setting the hreflang part of the alternate meta link for each store. All configuration in this case is done under the Default Config scope in the admin panel.

This is an optional setting intended for adjusting the combination of alternate links if you're not satisfied with their automatic generation. If you're unsure what to enter in those fields, it's recommended to use the Enabled for all websites option in Enable alternate and hreflang links configuration.

note

Google does not recommend using the URLs with a ? parameter for the multilingual stores, such as: http://store.com/yourpage.html?___store=french. To get more information about Google multilingual URLs requirements, refer to multi-regional and multilingual sites page.

Set alternate and hreflang for CMS pages

To inform the Magento system that certain CMS pages are alternates, you need to group these pages under the same Alternate group. This is an additional parameter introduced by the Advanced SEO Suite extension.
Go to the required CMS page's edit menu and open the Alternate settings tab. You can use any word as the group name. A CMS page will display alternate links to other pages that share the same Alternate group name.