1

I am using hreflang between languages on a global website. My hreflang code is:

<link rel=”alternate” href=”https://example.com/en/” hreflang=”en” />
<link rel=”alternate” href=”https://example.com/tr/” hreflang=”tr” />
<link rel=”alternate” href=”https://example.com/en/” hreflang=”x-default” />

Should I use also include hreflang in the sitemap?

<url>
<loc>https://example.com/</loc>
<xhtml:link
  rel="alternate"
  hreflang="en"
  href="https://example.com/en/"
/>

<xhtml:link
  rel="alternate"
  hreflang="tr"
  href="https://example.com/tr/"
/>

<xhtml:link
  rel="alternate"
  hreflang="x-default"
  href="https://www.deezer.com/en/"
/>
</url>

1 Answer 1

2

TLDR: That is fine as long as they don't conflict with each other. For example if one country version of an hreflang directive appears on the page, but that same directive is assigned to a different page in the sitemap.

Google's John Mueller on hreflang directives being included in the sitemap and the source code of web pages

“What would happen there is we would combine those. From our point of view hreflang is not something where we say you can only have one language or country version on one page, but rather you can have multiple country versions on the same page. And you can have multiple different levels."

"So you could say this is the page for English in Singapore, English in US, English in UK, and you have a different page for English in Australia, for example. You can have one page with multiple country/regional targeting on them. So if you have some hreflang in the HTML, and some in the sitemap, then we would try to combine that and add that together. That means that if you have multiple different country versions across those different things we would just combine that into one setup.”

He also states where you can run into potential problems

“The one place where it would get confusing, or where we would see it as conflicting is if you have one country language version on the page and you use the same country language version for a different page in the sitemap file. That’s one situation where our systems would probably have to guess.”

Full Article

5
  • 4
    That implies that if you have hreflang in your pages, you don't need to include it in your sitemap. In fact you probably shouldn't so that there is no possibility of conflicting data. Commented Aug 20, 2021 at 6:06
  • 3
    In conclusion, does it make more sense to just use hreflang in <head> tags? Commented Aug 20, 2021 at 9:43
  • 3
    That is my conclusion. If you put it in the sitemap, it probably won't hurt unless you mess it up or until the URLs change and the sitemap doesn't get updated. But why take that risk? Commented Aug 20, 2021 at 14:35
  • 2
    @ardacar I always prefer the <head>. I've only used the sitemap method when for some reason, whether due to CMS restrictions or something else, modifying the contents of the <head> is not an option. Commented Aug 20, 2021 at 15:04
  • 2
    Got it, thanks for your answers. So there is no advantage to using both at the same time :) Commented Aug 20, 2021 at 15:42

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.