Search code examples
seoxml-sitemap

Sitemap file multilingual with dynamic content


I have a DYNAMIC website with 4 different languages, I would like to set the sitemap.xml file, I have some questions to set how to start:

1- Is the sitemap.xml is still mandatory in SEO? Because I've visited so many websites well ranked and they don't have that file

2- The best way to set a sitemap, is to include dynamic fields or not, i.e: I add entries into the database, do I have to include them or just constant pages, such as, contact, home page, about us ...

If do I have to set dynamic items, do I have to generate 4 sitemaps, each language with it's own sitemap, OR I should combine all of them?

This is what I did, I combined all the languages in one file, as of dynamic page 1 and dynamic page2, this will generate 1000 lines as dynamic pages, each entry will have a translation in 4 languages:

<?xml version=”1.0″ encoding=”UTF-8″?>

<urlset xmlns=”http://www.sitemaps.org/schemas/sitemap/0.9″

xmlns:xhtml=”http://www.w3.org/1999/xhtml”>
<url>
  <loc>http://www.example.com/en/dynamic-page1.html</loc>
  <xhtml:link 
    rel="alternate"
    hreflang="fr"
    href="http://www.example.com/fr/page-dynamique1.html" />
  <xhtml:link
    rel="alternate"
    hreflang="en"
    href="http://www.example.com/en/dynamic-page1.html" />
</url>
<url>
  <loc>http://www.example.com/en/dynamic-page2.html</loc>
  <xhtml:link 
    rel="alternate"
    hreflang="fr"
    href="http://www.example.com/fr/page-dynamique2.html" />
  <xhtml:link
    rel="alternate"
    hreflang="en"
    href="http://www.example.com/en/dynamic-page2.html" />
</url>
</urlset>

Thank you in advance


Solution

    1. Yes, it's preferable to have sitemap because this is another signal for Google to pick up for your preferred pages to index.

    2. Combined all the languages in one file with dynamic page 1 and 2 is fine. The only thing that I will say is to the add last modify date, example

       <lastmod>2020-03-04</lastmod>
      

    The sitemaps should be no larger than 50MB (52,428,800 bytes) and can contain a maximum of 50,000 URLs

    You can create different sitemap based on your site structure, e.g. Product sitemap, services, blog, and so on this will help in debugging and analysis your page's performance on GSC.