I run a multi language web page with two languages. I'm wondering how to prepare the sitemap.xml
file friendly for Google search engine.
For main site address example.com
, the default language is pl-PL
. The simple language code is pl
. The second language is en-GB
with simple code en
.
So the first address with default language is: example.com
The same page with the first lang code: example.com/pl/
(domain name with simple language code) is the same page.
And the same page is also for example.com/pl/home-page/
(language-code/site-code)
So main page with dafault language has 3 copies.
The second language is en
with address example.com/en/
and example.com/en/home-page/
.
Following the Google advises for multi language sites:
If two sides do not point to each other, the tags will be ignored. Thanks to this, no one can create a tag on another site pointing to any page as an alternative version of one of your pages.
the sitemap.xml should look like
<?xml version="1.0" encoding="UTF-8"?>
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:xhtml="http://www.w3.org/1999/xhtml"
xsi:schemaLocation="http://www.sitemaps.org/schemas/sitemap/0.9
http://www.sitemaps.org/schemas/sitemap/0.9/sitemap.xsd
http://www.w3.org/1999/xhtml
http://www.w3.org/2002/08/xhtml/xhtml1-strict.xsd">
<url>
<loc>https://example.com/</loc>
<xhtml:link rel="alternate" hreflang="pl-PL" href="https://example.com/" />
<xhtml:link rel="alternate" hreflang="pl-PL" href="https://example.com/pl/" />
<xhtml:link rel="alternate" hreflang="pl-PL" href="https://example.com/pl/home-page/" />
<xhtml:link rel="alternate" hreflang="en-GB" href="https://example.com/en/" />
<xhtml:link rel="alternate" hreflang="en-GB" href="https://example.com/en/home-page/" />
<priority>1.00</priority>
</url>
<url>
<loc>https://example.com/en/</loc>
<xhtml:link rel="alternate" hreflang="en-GB" href="https://example.com/en/" />
<xhtml:link rel="alternate" hreflang="en-GB" href="https://example.com/en/home-page/" />
<xhtml:link rel="alternate" hreflang="pl-PL" href="https://example.com/" />
<xhtml:link rel="alternate" hreflang="pl-PL" href="https://example.com/pl/" />
<xhtml:link rel="alternate" hreflang="pl-PL" href="https://example.com/pl/home-page/" />
<priority>1.00</priority>
</url>
</urlset>
Google Search Console accepts this file but I want to ask if there is redundace? My simples version could be:
<?xml version="1.0" encoding="UTF-8"?>
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:xhtml="http://www.w3.org/1999/xhtml"
xsi:schemaLocation="http://www.sitemaps.org/schemas/sitemap/0.9
http://www.sitemaps.org/schemas/sitemap/0.9/sitemap.xsd
http://www.w3.org/1999/xhtml
http://www.w3.org/2002/08/xhtml/xhtml1-strict.xsd">
<url>
<loc>https://example.com/</loc>
<xhtml:link rel="alternate" hreflang="pl-PL" href="https://example.com/" />
<xhtml:link rel="alternate" hreflang="en-GB" href="https://example.com/en/" />
<priority>1.00</priority>
</url>
<url>
<loc>https://example.com/en/</loc>
<xhtml:link rel="alternate" hreflang="en-GB" href="https://example.com/en/" />
<xhtml:link rel="alternate" hreflang="pl-PL" href="https://example.com/" />
<priority>1.00</priority>
</url>
</urlset>