How to fix sitemaps in multisites of languages in WordPress? This will be a very short post because it deals with a limitation I find in the SEO plugins of the WordPress ecosystem and I give you my solution for XML sitemaps by languages.
Sitemaps are one of the most relevant files in terms of SEO because it is a type of content that, as we can see, is frequently visited by search robots.
They provide a list of the main URLs of a site that are submitted for indexing.
Not only can we take advantage of it for content types, but also for images, videos, news. Google’s documentation is very clear about this. It helps to better crawl a site.
I tend to be very strict with sitemaps. I think it is a file that we should have 100% in 200 codes and only with the content that we want to be indexed.
Famous SEO plugins such as:
They all generate their own sitemap based on the type of content that you indicate to be indexed in Google.
In the following screenshots we can check some of them:
The problem is that for multi-language websites two limitations are generated depending on the casuistry:
- A regular WordPress with any language plugin such as: Polylang, WPML, WeGlot, TranslatePress, etc.
- A WordPress multisite with MultilingualPress where each language is generated in the subfolder of the corresponding language.
In the first option, there would be no problem.
One thing I do NOT like about SEO plugins is that they generate the generic sitemap mixing all languages. It does not seem positive to me. I think that each language should have separate sitemaps.
The only exception is the veteran All in One SEO, a plugin that from my point of view was left behind in many functionalities offered by more modern SEO plugins.
But just in this functionality, they do better than the rest. See capture:
For an order freak, having the languages separated in the sitemap is very nice.
The second option (multisite) is very convenient for many companies because it allows to have each language as a different website. It is scalable, it works well, but it creates an absurd problem.
Let’s imagine the following fictitious domain:
- https://misexyweb.com/ > We assign it to the main language, in this case English.
- https://misexyweb.com/es/ > For the Spanish
- https://misexyweb.com/fr/ > For French and so on.
The problem is that the default SEO plugins will set a sitemap.xml per website.
This means that in Spanish we will have for example:
And this, as usual, will show the sitemap only for the English language.
It is obvious that we can send each sitemap to Google and that’s it, using the functionality in Search Console.
But I don’t think we should rely only on that because Google or other search engines will default to the main domain and visit only the sitemap of the main language, in this case English:
Therefore they will have no knowledge of the other languages and this is a “package deal” in terms of indexing and crawling.
What I usually do in these cases, is to create (manually) a sitemap of sitemaps on the main domain.
This is useful because it allows us to override the default behavior of the SEO plugin. For example, something like this:
<?xml version="1.0" encoding="UTF-8"?> <sitemapindex xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"> <sitemap> <loc>https://misexyweb.com/sitemap_index.xml</loc> <lastmod>2023-08-22 17:00 +02:00</lastmod> </sitemap> <sitemap> <loc>https://misexyweb.com/es/sitemap_index.xml</loc> <lastmod>2023-08-22 17:00 +02:00</lastmod> </sitemap> <sitemap> <loc>https://misexyweb.com/it/sitemap_index.xml</loc> <lastmod>2023-08-22 17:00 +02:00</lastmod> </sitemap> <sitemap> <loc>https://misexyweb.com/fr/sitemap_index.xml</loc> <lastmod>2023-08-22 17:00 +02:00</lastmod> </sitemap> <sitemap> <loc>https://misexyweb.com/pl/sitemap_index.xml</loc> <lastmod>2023-08-22 17:00 +02:00</lastmod> </sitemap> <sitemap> <loc>https://misexyweb.com/ru/sitemap_index.xml</loc> <lastmod>2023-08-22 17:00 +02:00</lastmod> </sitemap> </sitemapindex>
As you can see it is very simple, I am just generating an index of the sitemaps of each language. I create the file: sitemap.xml and upload it to the root folder.
In this way each sitemap of each folder is updated by itself. This is actually done by the SEO plugin. The only thing I do is to leave you the complete list and also, ordered by language, which I think is the most positive thing.
I hope this solution will help you. If you have another one, I’ll be happy to read it in the comments.
And I hope this is taken into account by the different WordPress SEO plugins to improve these sitemap functionalities. I will make these observations when I have the opportunity.
Something as simple as a manual modification of the default sitemap is not feasible nowadays without putting some code, as Fernando Tellado teaches us for example in his article about SEOPress and how to add additional URLs to the XML sitemap.
So the management of the sitemaps by the SEO plugins is frankly good, except for these details, which hopefully can be improved in future editions.
I promise to create an SEO guide on sitemaps very soon in video, which I believe is an essential file that we don’t pay much attention to.
Long live and prosper WordPress!