Multiple Sitemaps in the same directory

Monday, October 09, 2006

We've gotten a few questions about whether you can put multiple Sitemaps in the same directory. Yes, you can!

You might want to have multiple Sitemap files in a single directory for a number of reasons. For instance, if you have an auction site, you might want to have a daily Sitemap with new auction offers and a weekly Sitemap with less time-sensitive URLs. Or you could generate a new Sitemap every day with new offers, so that the list of Sitemaps grows over time. Either of these solutions works just fine.

Or, here's another sample scenario: Suppose you're a provider that supports multiple web shops, and they share a similar URL structure differentiated by a parameter. For example:

  https://example.com/stores/home?id=1
  https://example.com/stores/home?id=2
  https://example.com/stores/home?id=3

Since they're all in the same directory, it's fine by our rules to put the URLs for all of the stores into a single Sitemap, under https://example.com/ or https://example.com/stores/. However, some webmasters may prefer to have separate Sitemaps for each store, such as:

  https://example.com/stores/store1_sitemap.xml
  https://example.com/stores/store2_sitemap.xml
  https://example.com/stores/store3_sitemap.xml

As long as all URLs listed in the Sitemap are at the same location as the Sitemap or in a sub directory (in the above example https://example.com/stores/ or perhaps https://example.com/stores/catalog) it's fine for multiple Sitemaps to live in the same directory (as many as you want!). The important thing is that Sitemaps not contain URLs from parent directories or completely different directories—if that happens, we can't be sure that the submitter controls the URL's directory, so we can't trust the metadata.

The above Sitemaps could also be collected into a single Sitemap index file and easily be submitted via Google Webmaster Tools. For example, you could create https://example.com/stores/sitemap_index.xml as follows:

<?xml version='1.0' encoding='utf-8'?>
<sitemapindex xmlns="https://www.google.com/schemas/sitemap/0.84">
  <sitemap>
    <loc>https://example.com/stores/store1_sitemap.xml</loc>
    <lastmod>2006-10-01T18:23:17+00:00</lastmod>
  </sitemap>
  <sitemap>
    <loc>https://example.com/stores/store2_sitemap.xml</loc>
    <lastmod>2006-10-01</lastmod>
  </sitemap>
  <sitemap>
    <loc>https://example.com/stores/store3_sitemap.xml</loc>
    <lastmod>2006-10-05</lastmod>
  </sitemap>
</sitemapindex>

Then simply add the index file to your account, and you'll be able to see any errors for each of the child Sitemaps.

If each store includes more than 50,000 URLs (the maximum number for a single Sitemap), you would need to have multiple Sitemaps for each store. In that case, you may want to create a Sitemap index file for each store that lists the Sitemaps for that store. For instance:

  https://example.com/stores/store1_sitemapindex.xml
  https://example.com/stores/store2_sitemapindex.xml
  https://example.com/stores/store3_sitemapindex.xml

Since Sitemap index files can't contain other index files, you would need to submit each Sitemap index file to your account separately.

Whether you list all URLs in a single Sitemap or in multiple Sitemaps (in the same directory of different directories) is simply based on what's easiest for you to maintain. We treat the URLs equally for each of these methods of organization.