2

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>
unor
  • 92,415
  • 26
  • 211
  • 360
uxmal
  • 428
  • 1
  • 7
  • 17
  • This question appears to be off-topic because it is about **SEO** which is off-topic at Stack Overflow. Please read ["Which SEO questions should be closed as non-programming/non-admin?"](//meta.stackoverflow.com/a/382618) to better understand when SEO questions are acceptable to ask here (most are not) and where you might be able to get assistance. – John Conde Jun 13 '19 at 21:41
  • 1
    Do you mean every proper site part (proper sitemap file) is SEO ? Every proper html, meta content, structural data question also provide better site position so finaly you can mark every question like that. Proper Sitemap is not for cheat google, it's normal site parts for every crawl service. – uxmal Dec 03 '20 at 18:59

1 Answers1

1

You should use the simpler/second version and, unless you already have, add canonical tags. Each submitted URL is a request to have that specific URL included in Google's index, so from an SEO-perspective, you only ever need to submit one entry per different page and language. It is however imperative that you have canonicalized your duplicated pages.