During a hangout Question and Answer segment, one SEO professional asked John Mueller about creating multilingual site sitemaps.
Their question was: what’s the best practice to create sitemap files for multilingual sites?
They explained that now, they are using a subfolder to differentiate the languages.
For the sitemap component itself, on URL value, should they use the XHTML link rel=alternate hreflang, with every available language version of the URL?
John explained that using subfolders or sitemap files is perfectly fine.
As he mentioned previously, it’s a reasonable approach to doing it. Google doesn’t care where your sitemap file is located so long as it’s in a valid location.
A valid location is something that you’re referring to yourself within the setup of your site.
So the robots.txt file, for example, you would point to a URL somewhere. Or you’re submitting it in Search Console, and you have the rest of your site also verified in Search Console.
Regarding hreflang attributes, you can use those in the sitemap file, and you can put them in the HTML of your page, you can put them in the headers of your page, where you do this is totally up to you.
Some people put it in one place, some people put it in another place. They sometimes also see that it depends a bit on who is actually working on the website.
Perhaps you don’t have access to the HTML code, or maybe you can’t set the HTTP headers, then putting it in a sitemap file is a good way to take advantage of those different locations.
This happens at approximately the 27:40 mark in the video.
John Mueller Hangout Transcript
John (Submitted Question) 27:40
What’s the best practice to create sitemap files from Multi Language websites? Right now we’re using subfolders to differentiate the languages. And for the sitemap component itself on URL value, should we use the XHTML link rel alternate hreflang, with every available language version of the URL?
John (Answer) 28:00
So using subfolders for sitemap files is perfectly fine. As I mentioned before, it’s a reasonable approach to doing it, we don’t really care where your Sitemap file is located, as long as it’s kind of in a valid location. And a valid location is something either that you’re referring to yourself within kind of the setup of your website. So with the robots.txt file, for example, you point us at a URL somewhere, or you’re submitting it in Search Console, and you have the rest of your site also verified in Search Console, then those sitemap files would be okay.
With regards to the hreflang attributes, you can use those in the sitemap file, you can put them in the HTML of your page, you can put them in the headers of your page, where you do that is totally up to you. Some people put it in one place, some people in another place. We sometimes also see that it depends a bit on who is actually working on the website, in that maybe you don’t have access to the HTML code, or maybe you can’t set the HTTP headers, then putting it in a sitemap file is a good way to kind of take advantage of kind of those different locations. I believe for our developer documentation, we use a sitemap file because we can’t easily add them to the headers. So we end up putting it there.