Hreflang tags are created as a perfect solution for any websites that have multiple versions of different languages.
Yet, do you know what hreflang tags are and why Magento 2 websites need them? Today I’ll help you understand its meanings and application in SEO for Magento 2.
Let’s get started.
I. What are Hreflang Tags in Magento 2?
Are hreflang tags as same as meta tags?
The hreflang attribute (also referred to as rel=”alternate “hreflang=”x”) informs Google the language you use on a specific page so that the search engine will serve as a link for search users in that language.
You can understand that hreflang tags are a type of method that marks up any pages with similar meanings but different languages and regions.
It’s also referred as rel=”alternate “hreflang=”x”.
So what does it do?
Hreflang tags inform Google of the languages you use on a specific page. When anyone who uses that language clicks on search results, a page with the matching language of the website is linked to the search users of these same languages.
There’re three common ways of implementing hreflang tags:
- Content with regional variations like en-us and en-gb.
- Content in different languages like en, de and fr.
- A combination of different languages and regional variations.
It’s confirmed that hreflang tags are fairly commonly used to target different markets that use the same language.
For example, to differentiate between Germany and Austria. Or between the US and the UK.
For more information about how the hreflang tags work, make sure to take in consideration of the official Google instructions.
II. Why eCommerce Websites Need Hreflang Tag?
The reason is quite simple.
To attract customers from many different countries around the globe, lots of eCommerce websites already prepared pages in multiple languages.
Hreflang tags are a technical solution for multi-language sites with similar content. Therefore, to redirect visitors to pages that have a suitable language, the hreflang tags are implemented.
Your store has a ranked page in English on Google and the same page in German.
Say a client finds your store on Google, yet instead of showing the German page, Google showed him your English ranked page. To let Google shows him the German page, you’d need to implement the hreflang tags.
When the hreflang tags are applied, that German client would see the German page and if he clicks the link, he’d be redirected to the German version of the page instead of the English one.
So we understand how it works, yet isn’t it the same as 301 redirects?
No, it’s even better.
Hreflang tags also prevent duplicate content issues that would very likely affect your SEO result. Especially if you want different prices in two countries for the same product within the same product pages.
And don’t mistake hreflang tags with 301 or 302 redirects since it doesn’t redirect your website itself.
The hreflang tags leave a signal to Google. And then, it’s Google that leads users to a suitable version of your store.
And it’s all the same for Magento 2 websites if you get yourself a multi-language store.
III. Does Every Magento 2 Website Need Hreflang Tags?
Various situations make hreflang tags become a must for your Magento 2 website.
Your store needs to implement the hreflang tags only if:
- The Magento store has similar content in different languages.
- Your content is written differently for each region.
For instance, you find yourself in the same popular situations as below:
- An eCommerce website that has three English versions: one for the USA, one for the UK and an international one.
- A website that is available in 3 different languages: English, Chinese, and French.
- A worldwide eCommerce website that has different variants for each continent: Asia, Europe, and America.
- A website that has different local languages in the same country.
If you find yourself in one of the situations mentioned above, then there’s no doubt that the hreflang tags are a must for your store!
IV. How to Manually Setup Hreflang Tags for Magento 2?
It’s a pity that default Magento 2 doesn’t have the hreflang tags feature. Yet we still can implement it via either coding or Magento 2 SEO suite.
Below are three common ways to manually implementing the hreflang tags. You could use some help from a developer to get it working.
1. XML Sitemap
Usually, you’d experience certain technical issues with Google Search Console when implementing the hreflang tags on the XML sitemap. It’s due to the nature of Google processing data.
Yet, developers prefer to use XML Sitemap files when implementing global websites with hreflang tags within each page’s HTML source code. Hreflang annotations are commonly believed to create more problems in the XML Sitemap than in the site header code section.
2. HTTP Heading of Each Page
This approach certainly has an advantage in comparison to the XML Sitemap files, Google is continuously collecting information from the HTTP header.
Even for URLs that lack native source code, you can set up HTTP headers for each of them, not to mention even for PDF files and other non-HTML files.
However, the method is quite complicated to use, and it’d only cause more troubles and difficulties than advantages.
3. HTML Header of Each Page
This method is quite simple, but it has some disadvantages, particularly when using the value of x-default.
Therefore, if your home page is intended to redirect customers based on the language and location specified from the browser, I would suggest that you consider using the first two methods.
Here is an example for using Hreflang attribute:
<link rel="alternate" href="http://example.com/" hreflang="en" /> <link rel="alternate" href="http://example.com/en-gb/" hreflang="en-gb"/> <link rel="alternate" href="http://example.com/en-au/" hreflang="en-au"/>
V. How to setup Hreflang Tags with BSS Magento 2 SEO Extension?
In case you don’t want to do all the hard works, you could use Magento 2 SEO suite to setup the hreflang tags quickly and at ease.
BSS Commerce Magento 2 SEO suite stands by you to eliminate all the duplicate content issues:
- Add the hreflang tags for each store view.
- Freely selecting languages and countries for a store view.
- Ability to enable the hreflang tags for the homepage, product, category or even CMS page.
Beside addition hreflang tags, this Magento 2 SEO suite also supports and adds various exclusive features for better ranking results of your store:
- Rich snippets added to highlight website on SERPs.
- Better site navigation with advanced breadcrumbs.
- Support social shares via Open Graph and Twitter Card.
- Advanced XML and HTML sitemap generation.
- Duplicate content elimination by Canonical tag.
- Meta tag auto-generation for products and categories.
- Name & ALT tag generation for images.
- Additional H1 for pages.
- 301 redirects & external links support.
- Useful Magento 2 SEO suite report and analysis toolbar.
After get it with the help of our support team, you’d need to setting up the hreflang tags.
It’s simple. Just follow my instruction:
- Navigate from the backend menu to Stores then click on Configuration.
- Scroll down and select the BSS Commerce SEO. Select HREFLANG Tag Support.
- By default, you don’t need to change any other settings since they’re all turned on. You could turn any of them off if you want by switching from Yes to No.
- To add Hreflang for Store View, select the Language and Country as your desire:
- For example, to add hreflang for any visitors who speak French that come from France, I choose French and France as language and country.
- After selecting them, I simply press the Add button.
Once you finish the setting for Magento 2 SEO suite, the hreflang tags will be placed automatically at the assigned store view and page type. Visitors who click on your page’s result on Google would be redirected to the appropriate store view.
Quite easy, isn’t it?
VI. What Mistakes Should You Avoid When Using Hreflang Tags?
According to the Search Engine Journal’s article, it’s critical for an online business to avoid the following mistakes when setting hreflang tags:
- Incorrect hreflang language settings.
- Hreflang tags conflict with the page’s source code.
- Invalid hreflang values.
- Pages without any hreflang attributes.
It’s also unnecessary to implement the hreflang tags for the website that targets only one location, or isn’t multi-language.
If your store has decided to go international, then appropriate hreflang tags are more than needed for your eCommerce website, especially for Magento 2.
Either coding manually or using our Magento 2 SEO suite, the hreflang tags have such importance that it’d affect both your potential customers and your SEO ranking results!
Have a look at our comprehensive Magento SEO guide for more information!
Got any questions or suggestions? Just leave your recommendations below and we’d answer them!