Why Take Care of Hreflang Tags & How to Effectively Use Them in Your Magento 2 Store?

0
27380
Hreflang tags in Magento 2 | MageWorx Blog
Reading Time: 6 minutes

Getting on the path of international expansion is a complex affair that requires a thought-out SEO strategy, an international one. Hreflang tags allow bringing the potential shoppers to the right content and offerings that fully match their queries, as well as let them avoid duplicate content issues. Let’s get into details and make hreflang tags setting a piece of cake!

Table of Contents

What are Hreflang Tags?

What are Hreflang Tags?

Hreflang is a technical solution for sites that have equal (or similar) content in different languages and/or target multiple locations. In other words, if you are running an international store in various languages or wish to sell outside of your country (even if the same language is spoken there), then the implementation of such tags is just the ticket for you.

For instance, there’s a potential French-speaking customer surfing the web. The page with a product the shopper is looking for is available in English in the search results but you’ve also got a French version. What is the objective? You should make sure this very customer arrives at the French version of the website or some other particular page. Hreflang tags help specify which users which pages are meant for. Before digging deeper, make sure to get yourself familiar with the official Google instructions.

Does Your Magento 2 Store Need Hreflang Tags?

Does Your Magento 2 Store Need Hreflang Tags?

If you answer ‘YES’ to at least one of the following statements, then such tags are a must for your site:

  • There is equal content in different languages in your Magento-based store.
  • There’s content written in one language that is meant for distinct regions.

Here’re some popular real-life scenarios for websites that require hreflang tags:

Example #1. An English-speaking website with three different versions: one for the US, another one for the UK, and the third one is meant for the rest of the world.

Example #2. A website in three international languages: English, Spanish, and French.

Example #3. An eCommerce store with a global reach that offers three versions for various continents: Europe, Asia, USA, and Canada.
Example #4: A US-based eCommerce site with website versions in English and Spanish.
Example #5: Website for one country with various local/state languages.

Hreflang Tags for Different Countries & Language Options

  • Hreflang value includes language and country codes that are separated by a hyphen.
  • Hreflang value is set only once. Thus, there can’t be two versions of your eCommerce store that simultaneously target the same language and users from one location (each language & country combination must be unique).
  • URL-addresses can simultaneously get a few hreflang values.

Why Would You Need Hreflang=”x-default”?

Why Would You Need Hreflang=”x-default”?

“X-default” is a special value of the hreflang attribute that shows which page your online shoppers must be directed to if none of the languages in hreflang tags conform to their browser settings. In other words, if the customers’ location and the language don’t correspond the settings, they get redirected to your eCommerce store version set as default. For example, a shopper from Germany searches for products in English. Normally, there will be no corresponding URL-address. In such a case, x-default is used.

What Blunders Should You Avoid?

hreflang mistakes
According to the source, it’s critical for an online business to avoid the following mistakes when setting hreflang tags:

  • incorrect hreflang links,
  • conflicts of hreflang attributes within the page source code,
  • wrong hreflang values,
  • pages with no hreflang attributes,
  • setting hreflang tags for a website that is not a multi-language one, or targets one location.

Hreflang Annotations: Pieces of Advice

Hreflang annotations must be implemented on the URL level. Thus, each set of URL addresses for different countries and languages get its own annotations.

  1. Not all eCommerce pages can exist in all the regions and languages. It’s not recommended to use hreflang annotations to indicate non-existent pages.
  2. Hreflang annotations are required solely for pages you wish to be indexed by the search engines – they are commonly product, category and CMS pages.
  3. It’s not recommended to include hreflang annotations in non-canonical URL-addresses.

3 +1 Popular Methods to Set Hreflang Tags

Methods to Set Hreflang Tags

1. XML Sitemap Files

There are certain problems when it comes to Google data processing in Sitemap files. Thus, when choosing this very method, you can come across certain errors in Google Search Console.
Normally, the developers prefer to use XML Sitemap files when implementing hreflang tags within the HTML source code of each page for global websites. It’s commonly believed that hreflang annotations create more issues in the XML Sitemap than in the header code section on the page.

2. HTTP Heading of Each Page

There are certainly some benefits of the method:
Google constantly receives data from the HTTP header as opposed to the XML Sitemap files.
You can configure HTTP headers for each URL, even for those ones that are missing native source code, as well as for PDF files and other non-HTML files.
Nevertheless, this method is quite complicated to use and causes more difficulties than advantages.

3. HTML Code Header Section of Each Page

This method is quite an easy one but it has certain disadvantages, especially when using x-default value. Thus, if the home page aims at redirecting the customers based on the language and location listed in the browser, I’d recommend considering using the first two methods, or a bonus one ;).

What is the Easiest Way to Set Hreflang Tags in Magento 2?

Seo Suite Ultimate extension for Magento 2 allows optimizing the process of adding hreflang tags and informing Google crawlers about the alternative page versions.

SEO Suite Ultimate MageWorxThis all-in-one solution helps deal with a great deal of SEO configurations, and hreflang tags is a small part of its functionality. You’ll be able to:

  • set hreflang URL scope (website or global),
  • use hreflang tags on product, category and CMS pages,
  • use the language code from the default locale,
  • manually select the language for the alternate URLs,
  • set the X-default hreflang attribute for non-localized pages,
  • connect localized pages of these type by means of ID, URL key or an hreflang attribute,
  • conveniently overview alternate hreflang settings.

Enabling Hreflang Tags

To tweak the functionality, go to Stores – Configuration – MageWorx – SEO – SEO Base – Hreflang URLs Settings.
The beauty of the module is the ability to make Store View-specific hreflang configurations. All you need to do is switch to the Store View you wish to set hreflang tags for.

SEO SUite Ultimate
The extension allows setting these tags within either one website (locally), or all your websites (globally). If the Website option is set, the Alternate URLs work within one website only, if Global — the Alternate URLs work between websites.
SEO SUite Ultimate
Additionally, you’ll be able to both simply disable/enable hreflang tags and specify what you wish to set them for:

  • categories,
  • products,
  • CMS pages,
  • landing pages.

SEO SUite Ultimate MageWorx Blog

Language Settings for Alternate URLs

You’ll need these settings in case you wish to set unalike default languages for each Store View of your site.
For example, English and French are default languages of two Store Views of your eCommerce store. The codes of these languages will be used by default for alternate URLs. You’ll get hreflang=”en” and hreflang=”fr”.
However, if you need to set a language that differs from the one specified for the Store View, you can disable the ‘Use Language Code from Default Locale’ setting, and select the required language manually by clicking the drop-down:

Language Settings for Alternate URLs

To change Store View default language, go to STORES ⟶ Configuration ⟶ GENERAL ⟶ General ⟶ Locale Options and make the necessary modifications.
You’ll need the ‘Country Code’ settings if you’ve got pages in the same language that target different locations. For instance, a page in English for the shoppers from Canada and the US. After you enable the setting, you’ll be offered to either use the Magento settings (the default ones) or specify the desired country code manually:

‘Country Code’ settings

X-Default

Enable this setting in a mouse click!

X-Default in Magento 2
Alternate URLs for CMS pages

The extension makes it easy to connect the localized versions of CMS pages.
Quite often, the merchants have to create several CMS pages – one for each language. As a result, the translated pages have different IDs, and often URL keys. To let the system determine you have the localized versions of the same page and add alternate URLs, SEO Suite Ultimate allows relating such pages by ID, URL or hreflang keys. The last option should be specified manually for each CMS page (with the exception of the home page).

URL Key 

Make sure to choose this option if you’ve decided to use the same URL key for the translated versions of the CMS page. The module will locate and group all the pages with the equal URL keys. Then, the correct alternate URLs will be added.

ID Key

This option will suit best the pages that have content in the same language for different Store Views. For instance, if your CMS page is in English but you target both Canada and the US, you probably have different Store Views for them.

Hreflang Key

We’d recommend going for this option if your CMS pages have different URL keys. The extension will add a new attribute for each CMS page. Thus, you’ll be able to enter the unique value for the same page and indicate that they have equal content but in different languages:

Alternate URLs for CMS pages

Convenience All-in-one Place

In order to facilitate the process of setting hreflang tags and testing the correct ones, the Magento 2 SEO Suite Ultimate extension allows you to conveniently overview the alternate site URLs right in the backend:
In fact, that’s where you get to see if the hreflang tags configurations have been made correctly. Otherwise, the boxes with errors will get highlighted in red in order to inform you.

Magento 2 SEO Suite Ultimate extension
Bottom Line

Correct hreflang tags configuration is critical for every online entity that has decided to go international. The SEO Suite Ultimate extension will take a good care of your Magento-based business (click here to learn more about Magento 1 version of the add-on), and make international SEO fast and easy.

Don’t hesitate to leave a comment below in case you’ve got any questions or suggestions!

LEAVE A REPLY

Please enter your comment!
Please enter your name here