I wanted to ask for some advice on the best way to proceed with hreflang tags on a sitecore site. Currently, we have an English only site but we will be launching 11 more language sites localized in the local language.

Our site is currently set up like www.abccompany.com/en. The other language sites will follow the same style like www.abccompany.com/fr for French, www.abccompany.com/de for German and so on.

When dealing with hreflang tags, there are some options but we are not sure the best way to proceed.

I copied the options directly from this page from Google Webmasters forum here:

    HTML link element in header. In the HTML <head> section of                      http://www.example.com/, add a link element pointing to the Spanish version of       that webpage at http://es.example.com/, like this:
<link rel="alternate" hreflang="es" href="http://es.example.com/" />

HTTP header. If you publish non-HTML files (like PDFs), you can use an HTTP header to indicate a different language version of a URL:
Link: <http://es.example.com/>; rel="alternate"; hreflang="es"

To specify multiple hreflang values in a Link HTTP header, separate the values with commas like so:
Link: <http://es.example.com/>; rel="alternate"; hreflang="es",<http://de.example.com/>; rel="alternate"; hreflang="de"

Sitemap. Instead of using markup, you can submit language version information in a Sitemap. ([more info here][2])

We also have a store site that is located on a subdomain like this: store.abccompany.com.

We know that there is a sitemap module that could be used for creating Option #3 above which is the sitemap.xml file but in your opinion with dealing with Sitecore sites, which would you recommend? Setting up the html link element in the header and do an HTML header for PDFs (Options #1 &2) or go with a sitemap module to add the hreflangs in the actual sitemap.xml file?

Thanks in advance for any insight you can give on the topic.

2 Answers 2


We have done this for several clients. I have added the alternate tags to the sitemap but that caused the sitemap to be too large and I didn't want to create multiple sitemaps. So we added the tag in the header. Then created a sitemap of just the English content because English was the default language. This way Google will be able to get to all the links in the sitemap and then the alternate tags on the page will be crawled as well.

The tags are similar

<link rel="alternate" href="https://www.company.com/de/john-doe/" hreflang="de" /><br>
<link rel="alternate" href="https://www.company.com/fr/john-doe/" hreflang="fr" /><br>
<link rel="alternate" href="https://www.company.com/es/john-doe/" hreflang="es" /><br>
<link rel="alternate" href="https://www.company.com/zh-CHS/john-doe/" hreflang="zh-Hans" /><br>
<link rel="alternate" href="https://www.company.com/en/john-doe/" hreflang="en" />

Note the language code doesn't include the region. Only use the region if you are going to have the same language different based on region. Example French in Canada fr-ca or French in France fr-fr. If the same everywhere just use fr. Also include all the languages including the one you are currently on. Very important is to make sure the lang attribute on the HTML tag is correct for the language you are viewing the site in. If not set Google will try and interpret the language from the content on the page.

When you have everything set up you can view any issue or how Google is viewing the tags by going to the Google Search Console and International Targeting. It will give you a count of what it found and some details on issues that you may need to resolve.

Some good pages to find more information.

https://support.google.com/webmasters/answer/189077 https://support.google.com/webmasters/answer/2620865

  • Thank you! You raise a great point about the sitemap.xml file getting too large and having to break them out. Great food for thought.
    – Maritsa B
    Nov 22, 2016 at 1:15

Having done this in the past for a customer, we implemented a small bit of code on the layout that would find all versions published in other languages and build out link attributes in the header, like so:

 <link rel="alternate" hreflang="nl-NL" href="http://www.mycompany.nl/company/careers" />
 <link rel="alternate" hreflang="pt-BR" href="http://www.mycompany.com.br/company/careers" />
 <link rel="alternate" hreflang="ja-JP" href="http://www.mycompany.jp/company/careers" />

I can't share the code, but we went with this approach as it would generate on every page, even those not in the sitemap.xml file, and would always be up to date if a page was recently published or unpublished in one locale. The code looked for all versions and rendered the version code and item URL for that particular locale using the site defined root URL.

This worked fine for the customer and had no measurable performance implications.

  • Hi Derek, I'm curious how large the site was for your customer? Just looking for a ball park range like was the site over 1,000 pages per language? Thanks.
    – Maritsa B
    Nov 22, 2016 at 21:25
  • 1
    @MaritsaB The site was about ~250 content pages in 11 locales and languages (multiple spanish and english locales).
    – Derek C
    Nov 23, 2016 at 14:53

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.