Wherever you put the hreflang is fine you have to use only one of the above methods. Find the methods suggested by Google here: Tell Google about localized versions of your page
Methods for indicating your alternate pages There are three ways to indicate multiple language/locale versions of a page to Google:
- HTML Tags
- HTTP Headers
- Sitemap
From personal experience i would suggest using the head method
Sitemap:
Pros:
More control over which pages have alternative language
Easy setup (crawl and set)
Cons:
Monthly Update
Head:
Pros:
Process can be automate by variety of plugins and scripts out there
Cons:
You can end up easily have hreflang issues on pages without alternative language (unless is done manually ignore this)
Note: Im not really sure what happens if you keep both but i find that unnecessary, keep it simple and healthy to avoid errors and eventually google ignoring your hreflang.
Examples
Using hreflang on sitemap.
Sitemap should look like this:
<url>
<loc>http://www.example.com/english/page.html</loc>
<xhtml:link
rel="alternate"
hreflang="de"
href="http://www.example.com/deutsch/page.html"/>
<xhtml:link
rel="alternate"
hreflang="de-ch"
href="http://www.example.com/schweiz-deutsch/page.html"/>
<xhtml:link
rel="alternate"
hreflang="en"
href="http://www.example.com/english/page.html"/>
</url>
Header shouldnt include hreflang since we have it on sitemap.
<head> no hreflang </head>
Using hreflang on header
Sitemap should look like this
<url>
<loc>http://www.example.com/english/page.html</loc>
</url>
Header should look like this:
<link rel="alternate" href="http://www.example.com/deutsch/page.html" hreflang="de">
<link rel="alternate" href="http://www.example.com/schweiz-deutsch/page.html" hreflang="de-ch">
<link rel="alternate" href="http://www.example.com/english/page.html" hreflang="en">
<link rel="alternate" href="http://www.example.com/english/page.html" hreflang="x-default">