Jeremy John
Jeremy John

Reputation: 1715

Can i use <sitemap> in <urlset>?

As the title can i use <sitemap> tag in <urlset> to point to my second sitemap?

<?xml version="1.0" encoding="UTF-8"?>
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">

  <url>
    <loc>http://website.com/page1</loc>
    <changefreq>hourly</changefreq>
  </url>

  <url>
    <loc>http://website.com/page2</loc>
    <changefreq>hourly</changefreq>
  </url>

  <sitemap>
    <loc>http://website.com/sitemap.xml?offset=1000</loc>
    <changefreq>always</changefreq>
  </sitemap>

</urlset>

or must i use <url> to point to my second sitemap:

<?xml version="1.0" encoding="UTF-8"?>
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">

  <url>
    <loc>http://website.com/page1</loc>
    <changefreq>hourly</changefreq>
  </url>

  <url>
    <loc>http://website.com/page2</loc>
    <changefreq>hourly</changefreq>
  </url>

  <url>
    <loc>http://website.com/sitemap.xml?offset=1000</loc>
    <changefreq>always</changefreq>
  </url>

</urlset>

I cannot use <sitemapindex> as i have too many pages to generate a total index file.

Upvotes: 2

Views: 3807

Answers (1)

unor
unor

Reputation: 96737

As the Sitemap protocol describes, you should use a Sitemap index file.

If you add a sitemap element as child of the urlset element (your first example), it will likely be ignored, as sitemap is not one of the expected elements.

If you add the sitemap as url element inside urlset (your second example), your sitemap file is just another URL entry in your sitemap. You shouldn’t expect that consumers handle this entry as another sitemap, as this is not a defined behaviour, but specific consumers might do this anyway, of course.

If you can’t provide a Sitemap index file, you could (as a better-than-nothing alternative) provide multiple Sitemap records in your robots.txt:

User-agent: *
Disallow:

Sitemap: https://example.com/sitemap.xml?offset=2000

Sitemap: https://example.com/sitemap.xml?offset=1000

Sitemap: https://example.com/sitemap.xml

Upvotes: 2

Related Questions