Multi-language websites SEO: How to create a hreflang sitemap

by RANKtoo Oct. 11, 2019

Why do you need hreflang attributes or sitemap?

If your webpages have alternate language versions for certain country or language, the best practice of telling Google those versions is to use hreflang attributes or sitemaps for multi-language versions of specific pages. Which should be done even though Google is able to find the alternate language versions of your page.

Moreover, the user’s location is one of the indications when Google shows the search result. And it is very important to let user visit the correct language version of your webpages.

In spite of the hreflang tags, in this article, we are going to talk about how to build an hreflang xml sitemap.

Even though there are many tools that can help you create a hreflang sitemap, learning the hreflang sitemap rules can help you identify if the hreflang sitemap is correct.

Here is how an hreflang sitemap looks like:

                

<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9" xmlns:xhtml="http://www.w3.org/1999/xhtml">

<url>
<loc>https://ranktoo.com/about.html

<xhtml:link rel="alternate" hreflang="en-us"https://ranktoo.com/about.html"/>

<xhtml:link rel="alternate" hreflang="zh-cn" href="https://ranktoo.com/cn/about.html"/>

<xhtml:link rel="alternate" hreflang="fr-fr" href="https://ranktoo.com/fr/about.html"/>


</url>
</urlset>


hreflang Sitemap rules:

• Specify the xhtml namespace as follows:

xmlns:xhtml="http://www.w3.org/1999/xhtml"

• Create a separate <url> element for each URL.

• Each <url> element must include a <loc> child indicating the page URL.

• After the <loc> element inside each <url> element must have a child element <xhtml:link rel="alternate" hreflang="supported_language-code"> that lists every alternate version of the page, including itself. The order of these child <xhtml:link> elements doesn't matter, though you might want to keep them in the same order to make them easier for you to check for mistakes.

These Hreflang tools can help you to create and test the hreflang tags and sitemap:

Aleyda Solis's hreflang tags generator tool for generating or modifying hreflang tags and heflang attributes in an XML sitemap.

Merkle SEO hreflang tag testing tool for validating hreflang tags on a single live page.

HREFLang checker and validator for validating hreflang tags on a single live page.

You can also use the International Targeting report to debug the most common problems.