A common question in multilingual WordPress websites is how to make sitemaps in different languages. Create a sitemap in two o more languages implies including additional attributes (hreflang tags), but sitemap plugins for WordPress don’t add these attributes. However some translation plugins include these annotations in header.
Introduction
A sitemap is a list of URLs of your WordPress website (pages, posts, categories, archives, etc). Sitemaps are usually made using two formats: HTML and XML.
- An HTML sitemap allows users to easily navigate a website. Users can go to the Sitemap to locate a page they are unable to find by searching or navigating through your website menus (Example: https://wplang.org/sitemap/)
- An XML sitemap is an easy way for website owners to inform search engines about all the pages and posts that are available on your WordPress site. XML sitemaps are submitted to search engines so they can crawl your website in a more effective way (Example: https://wplang.org/sitemap.xml)
1. What information can include an XML sitemap?
XML Sitemaps usually include a list of URLs and optional information about each URL such as:
- How important it is (priority of URL relative to other URLs)
- How frequently it changes (daily, weekly, monthly, never, etc)
- The date of last modification
- Images or videos included on each URL
Example of sitemap generated by WordPress SEO by Yoast:
However sitemaps also can include information about alternative language URLs in multilingual websites (hreflang annotation).
Example of sitemap generated by Sitemap Generator:
2. What is hreflang annotation?
One of the main difficulties with multilingual SEO is the successful targeting of the correct website to the correct country or region, so that search users in a country or region find the site that is aimed at them.
One useful solution to this problem is using hreflang attributes (rel=”alternate” hreflang=”x”). These attributes were released at the end of 2011 and updated in 2013 to support the x-default value. It’s used by Google (and Yandex) to correctly identify the language and also the country targeting of multilingual websites (Bing uses the “content-language” meta tag).
Imagine you have an English page at http://www.mydomain.com/, with a French version at http://fr.mydomain.com/
According to Google you can indicate that the French URL is equivalent of the English page using hreflang attributes basically in two ways:
- HTML link in header. In the HTML section of http://www.mydomain.com/, add a link element pointing to the French version of that webpage at http://fr.example.com/, like this:
<link rel=”alternate” hreflang=”en” href=”http://www.mydomain.com/” />
<link rel=”alternate” hreflang=”fr” href=”http://fr.mydomain.com/” />
This example shows a subdomain but it works across different domains or subfolders.
If you’re using in your website a translation plugin in a single WordPress installation (such as WPML or Polylang) or a translation plugin in a WordPress Multisite environment (such as Multilingual Press or Multisite Language Switcher), then you do not have to worry because these plugins can automatically include these attributes in your website header.
Example of this webpage:
- Sitemap. Instead of using an HTML link in header, you can include language version information in a Sitemap. An example:
IMPORTANT: Google recommends choosing only one way to implement hreflang annotations, in order to avoid errors.
3. How can you make an XML sitemap with alternative languages?
The first option is create your sitemap manually following Sitemaps XML protocol, but this can be time-consuming.
It’s much better to use a WordPress plugin or a special software to create sitemaps automatically.
3.1. WordPress plugins
There are different plugins to create a sitemap in WordPress. I use Yoast’s WordPress SEO plugin, since it has a section for this purpose and unlike other plugins includes images (Go to SEO > XML Sitemap and enable Sitemap functionality). Anyway there are other sitemaps plugins: Google XML Sitemaps, Better WordPress Google XML Sitemaps, XML Sitemap & Google News feeds or Google Sitemap by BestWebSoft.
These plugins include in sitemaps information about priority, change frequency and the date of last modification (WordPress SEO also includes images), however none of them include hreflang tag for language URLs.
Solution:
- Using a sitemap plugin, such as WordPress SEO or Google XML Sitemaps
- And a translation plugin that adds automatically hreflang annotations in the header of your website
3.2. Software
Another option is choosing from a number of third-party tools to generate your sitemap automatically.
The only software I’ve found that includes hreflang in sitemaps is a paid solution called Sitemap Generator that costs $19.99 (free version doesn’t include hreflang tag in sitemap). It’s a php script which is designed to run on the server that hosts your website. It is another option that you can use on your multilanguage WordPress website.
It generates any kind of sitemap: XML, HTML, text formatted, mobile sitemap and optional extras such as images sitemap, video sitemap, news sitemap or RSS Feeds.
Anyway this software automatically detect hreflang from your website, but also you can specify manually alternative language versions for your posts and pages. Install this software on the server that hosts your website, log in http://mydomain.com/generator and go to Configuration > Advanced Settings > Include hreflang for language URLs in sitemap.
Note that Google strongly recommends that you choose only one way to implement hreflang tags, in order to avoid inconsistent signals and errors, so if you are going to use this software, you should avoid that your translation plugin displays hreflang in the head section. For example, WPML has this option, just go to WPML > Languages > SEO Options and uncheck the box “Display alternative languages in the HEAD section”:
4. How to manage multilingual sitemaps in Google Webmasters Tools?
Search engines are very smart in finding a sitemap. However, it is always advisable that you submit your sitemap to search engines by using webmaster tools. The benefit of this is that search engines will now show you pages indexed, any errors, and other relevant information that will be helpful.
4.1. Subdirectories or subfolders
If you use subdirectories or subfolders you will have a single domain in Google Webmaster Tools, but note that you can add subfolders (or subsites) in Google Webmasters Tools as a separate sites.
Webmaster Tools data and reporting work best on a site level. For example, if your site http://www.example.com has separate sections for different countries, we recommend adding each of those subsites or subfolders as a separate site. For example, if you have a travel site with specific subfolders covering Ireland, France, and Spain, you could add the following sites to your Webmaster Tools account:
http://www.example.com
http://www.example.com/france
http://www.example.com/ireland
http://www.example.com/spain
This means that if you are using subdirectories for each language, then it is advisable to add each of them on Google Webmasters Tools. This way you can use International Targeting section in Google Webmasters Tools on each subdirectory.
WordPress single installation
If you’re website is using:
- Languages in subdirectories (http://mydomain.com/fr)
- A WordPress single installation
- A translation plugin (WPML, Polylang, etc)
- A sitemap plugin (WordPress SEO or Google XML Sitemaps)
Then you may create one sitemap in the primary domain (http://mydomain.com) and submit to Google Webmasters Tools. This sitemap will include all the URLs mixed in different languages.
Go to Site dashboard > Crawl > Sitemaps > Add/Test Sitemap (red button):
A very common case is using WordPress SEO by Yoast and WPML.
For example, WPML website is using WordPress SEO by Yoast for sitemaps and WPML as a translation plugin. As you can see in the screenshots, sitemaps generated mix URLs in different languages, but this is not a problem since in header are included hreflang attributes.
- Global sitemap: http://wpml.org/sitemap_index.xml
- Page sitemap 1: http://wpml.org/page-sitemap1.xml
And if you have a look at the HTML code:
WordPress multisite
If you’re website is using:
- Languages in subdirectories (http://mydomain.com/fr)
- WordPress multisite
- A translation plugin (Multilingual Press or Multisite Language Switcher)
- A sitemap plugin compatible with WordPress multisite (WordPress SEO or Google XML Sitemaps)
You should activate your sitemap plugin for the entire network of sites and create a sitemap for each site (and language). One for your French version, one for your Spanish version:
- http://www.mydomain.com/fr/sitemap_index.xml
- http://www.mydomain.com/es/sitemap_index.xml
- http://www.mydomain.com/de/sitemap_index.xml
- Etc…
And submit them one by one in Google Webmasters Tools.
4.2. Domains or subdomains
In this case you will have different domains or subdomains in Google Webmasters Tools. Note that Google consider subdomains as separate sites in Google Webmasters Tools (you should add each subdomain in webmasters tools).
If you’re using domains or subdomains for different languages, then you need to create different sitemaps for each domain or subdomain, and submit them separately.
Activate your sitemap plugin for the entire network of sites and create a sitemap for each domain or subdomain.
Example:
- https://wplang.org/sitemap.xml (English)
- http://es.wplang.org/sitemap.xml (Spanish)
- http://de.wplang.org/sitemap.xml (German)
Hreflang annotations in header:
5. How can I know if I’m using hreflang correctly?
When you configure hreflang annotations, Google finds them on your website and crawls the corresponding URLs referred to by the tags, reporting errors.
This helps you maintain a healthy international presence so that search results for your visitors display the language and country variant you want them to see
In Google Webmasters Tools, you can use two sections in the International Targeting page: Language section and Country section. Just go to your Site dashboard > Search Traffic > International Targeting.
5.1. Language section
This section helps you ensure your hreflang tags use the correct codes (language and optional country).
This section can displays two common errors in multilingual sites:
- Missing return tags from alternate languages. For every language code and alternate URL, Google checks that the alternate page has a return tag that links back to the page or post on your site. This is the most common error for international sites. You can inspect details by clicking on an error. While writing this article I realized that the English version of this blog has errors on some hreflang tags:
- Unknown language codes. In case you’re using an incorrect or unknown language code in your hreflang attributes.
The value of the hreflang attribute identifies the language and optionally the region of an alternate URL. For example:
de: German content, independent of region (list of language codes)
de-CH: German content, for users in Switzerland (list or regions codes)
More info about errors: Troubleshooting hreflang annotations in Webmaster Tools. Official Google Webmaster Central Blog
5.2. Country section
You can use the Country section to set a site-wide country target for your entire site, if necessary.
From the International Targeting section, go to the Country tab and choose your country target.
This is important if your site has a generic top-level domain ( .COM, .ORG, .NET, etc), and targets users in a particular country or regional location. This improves search results for geographic or regional queries.
If your site has a country-coded top-level domain (.ES, .FR, .RU, .DE, etc) it is already associated with a geographic region (Spain, France, Russia, Germany). In this case, you won’t be able to specify a country location.
In other cases, if you don’t want to associate your site with any country, do not check the box “Target users in” or just select “Unlisted”.
For example:
- English version of this site is not associated with any country, because it is aimed at everyone speaking English regardless of the country
- Same happens with the Spanish version, since it is aimed at Spanish-speaking people, not only Spain but countries in Latin America
I hope this post has helped you understand how you can make sitemaps in WordPress in multiple languages. Thanks for sharing!
References:
- Using the Correct Hreflang Tag: A New Generator Tool. The Moz Blog
- Case Study: The Impact of HrefLang Tag. SEER Blog
- How To Implement The hreflang Element Using XML Sitemaps. Search Engine Land Blog.
Alberto says
Hi, thx for your post, i upgraded yoast to last version, but in my sitemap i dont recognize any hreflag parameter, can you help me?
Irena Domingo says
WordPress SEO by Yoast does not insert hreflang tags in sitemaps. As explained in the article the easiest way to insert hreflang tags in WordPress is using a translation plugin (WPML, Polylang, Multisite Language Switcher…)
Aruna says
Hi Irena,
Are these translation plugins – WMPL, Polyland, Multisite Language Switcher are free to use or do they charge? I like to know if you can suggest a plugin that does the work of WPML and free to download. Kindly let me know.
Thank you!
Irena Domingo says
Read this article: http://wplang.org/translation-plugins-languages/
Luigi says
Hi Irena, very interesting article indeed.
But the problem stays unsolved : how do you add the hreflang tags into the wordpress website xml sitemap?
WPML adds this tag to every page if you want, but how do you “transfer” this information to the sitemap?
Irena Domingo says
Hi Luigi,
Thank you very much. It’s not necessary “transfer” hreflang tags to the sitemap. You just need a sitemap plugin (to create sitemaps in different languages without hreflang tags) and a translation plugin that adds hreflang annotations in the header. This way Google understands perfectly your multilingual website.
If you’re not using a translation plugin, you can create your sitemap manually following Sitemaps XML protocol.
Luigi says
Hi Irena,
looks like google’s best pracrtice for submitting a multilingual website sitemap is to have one sitemap for all languages, and use the hreflang tag inside the XML sitemap, as explained in this article :
https://support.google.com/webmasters/answer/2620865?hl=en&ref_topic=2370587
This is why I am trying to find a worpress plugin that is capable of creating a sitemap containing all the hreflang tag information for each localized page. Any clues on which plugin might do this? (SEO Yoast, doesn’t seem to do this).
Irena Domingo says
Hi Luigi,
The article you mention says “you can use Sitemaps to provide Google with rel=”alternate” hreflang=”x“. It is a possibility (not obligation)
In this article (https://support.google.com/webmasters/answer/189077?hl=en), Google says that you can use language annotations (hreflang tags) in different ways: HTML link in header, HTTP header or sitemap.
Anyway, I haven’t found any WordPress plugin capable of creating a sitemap containing hreflang tags.
Grunge says
So i am using qtranslate-x plugin and also use yoast wordpress SEO , also i have multilanguage site in 3 languages and i noticed yoast does not index other languages does it mean i need to disable xml sitemaps in yoast and use some plugin for that ?
Irena Domingo says
No, just add each language version in Google Webmasters Tools
grunge says
Well i did something i disabled yoast xml cause i was unable to find out how to create sitemaps for my multilanguage site installed another plugin Google XML Sitemaps v3 for qTranslate i modified some parts of the code in order to work with qtranslate-x and i liked what i got. (i got all my languages listed in the new sitemap i created) , now just to find out how to create separate pages sitemaps 🙂 btw 5 star for How To Make Sitemaps In Multiple Languages With WordPress
Namee says
Hi Ireana,
It’s an awesome blog post, you clear all my issue with this post… Very simple and impressing writing & it helps me a lot.
I have one more question about multi language websites that, what about robots.txt?
Should I add make a different robots.txt for each version of the website or for main domain is ok? Please suggest your post if you have already written about it.
Thanks in advance.
Irena Domingo says
One robots.txt file is OK, except if you are using different WordPress installations in different servers in which case you need a robot file for each installation
Leslie says
Hi Irena,
Your posts appears to be the definitive guide for multilingual sitemaps.
I saw one of your users who commented uses qtranslate-x, and he couldn’t generate a sitemap, the good news is that the plugin author John is in the process of adding multilingual sitemap functionality to the plugin but we need some of your advice as you seem well versed in the subject.
We would really appreciate your insights and advise on which style sitemap would function best from our conversation here: https://github.com/qTranslate-Team/wp-seo-qtranslate-x/issues/1
There are basically 4 options, 3 of which are in the images Current Sitemap Structure, Current Sitemap Alternate Structure, Best Sitemap Structure the fourth being Current Sitemap Structure (less the green image inserts).
Please advise either here or in the github post on which option is best as we are undecided.
Many thanks.
Irena Domingo says
Hi Leslie,
I think the best option is using a different sitemap per language. For example, WordPress SEO by Yoast supports WPML and generates a sitemap for each language in the appropriate language folder. Real example using WPML and SEO Yoast:
Default language: http://www.wpml.org/sitemap_index.xml
Spanish: http://www.wpml.org/es/sitemap_index.xml
French: http://www.wpml.org/fr/sitemap_index.xml
German: http://www.wpml.org/de/sitemap_index.xml
Leslie says
Thanks
Thomas Aggerholm says
Hi Irena,
you write that Yoast support WPML for multilanguage-sitemaps, but how about Polylang? We have a site set up with WP4.4, Polylang newest, Yoast newest and we have 4 languages set up as subdomains in Polylang settings.
http://sub.domain.dk – danish
http://sub.domain.se – swedish
http://sub.domain.no – norwegian
http://sub.domain.fi – finnish
Have activated sitemap XML in yoast plugin, but it only outputs the main/default language in XML. How to get the other languages?
Irena Domingo says
This Sitemap plugin is compatible with Polylang: https://wordpress.org/plugins/xml-sitemap-feed/
indra says
hi, irena..this is great topic, very similar to mine
i found sitemap plugin that support polylang https://wordpress.org/plugins/xml-sitemap-feed/
but it can only generate xml
maybe you know how to convert the xml into nice readable html sitemap
indra says
yay, this one works…just edit the content with shortcode [wp_sitemap_page]
https://wordpress.org/plugins/wp-sitemap-page/
Bizzaviet says
Difficult to make multiple languages site 🙁 Do you have easy way? Thanks
Thomas Aggerholm says
I have a WP single-site, with Polylang for language and Yoast SEO installed. Have created – Scandinavian languages by subdomains and activated Yoast XML sitemap feature.
Have set up the languages in Polylang by sub-domain, not subfolder, but Yoast only export the primary language (da-DK) to the sitemap and I can’t seem to get a specific XML url for each language/subdomain. Only the primary one.
So my question is regarding the Polylang plugin – doesn’t it support multiple subdomain sitemap-xmls or is it the Yoast SEO that doesn’t support Polylang?
Irena Domingo says
Hi Thomas, have a look at this plugin: https://wordpress.org/plugins/xml-sitemap-feed/
Alain says
Hi there,
I have the same problem, and Yoast only provides xml sitemaps in different languages with WPML, not with Polylang.
To date, nobody could answer this question: how to generate xml sitemaps for different languages, for ex. mydomain.com and Mydomai.com/fr?
And yet, I need to feed Goole Search Conole with a News news xml sitemaps for the two different languages of my magazine…
Is it a too difficult issue to solve ? Does anyone have an idea on this site ?
Thanks for the help.
Thomas Aggerholm says
Hi Alain,
have you come across a solution to this shared problem? GWT wants one sitemap per subdomain or subfolder, but polylang only seem to produce one sitemap with all country articles/posts inside.
Some say that GWT will figure this out by itself, if you state your other domains in robots.txt, but I still need to see this working properly.
@Thomas Schulz – thanks for your input, but wouldn’t it be the best solution to let the website produce the XML sitemap? I consider your suggestion as final way out 🙂
Thomas Schulz says
Hi Thomas (Danish too?)
If the website can produce it, then of course that is a good solution 🙂
I would think most decent sitemap solution should be able to limit sitemap urls in a sitemap file to specific directories or apply (possibly separate) “scan” and “output” filters, so e.g. all urls with a regular expression pattern containing “fr” would be included in sitemap-fr.xml etc.
The hreflang information is relatively new in A1SG, so above would have been the solution in the past. But now hreflang information can be included as well (but interested in hearing of more test cases)
Thomas Schulz says
For software solutions, you can consider adding A1 Sitemap Generator (Mac and Windows desktop software)
By combining “alternate/hreflang” info (when available), language detection and URL analysis it can generate XML sitemaps with hreflang information for most websites.
For more information, see:
http://www.microsystools.com/products/sitemap-generator/help/website-page-url-language/
Info says
Hi,
This Article was very helpful, and this article helps us to know about how to register the site in Multiple languages, and how to index it within google, It shows the step by step illustrations, with images so it is very easy to understand, I must appreciate your effort.
Thank You for this informative article it is very helpful for all of us.
Miguel Calapez Fernandes says
Hi
Thank you for all this information. I’ve one question;
What happens with a bilingual site with country coded domain and with a english version that is aimed to everyone speaking english regardless the country?
Best regards
Miguel