How to Specify Two Sitemaps in robots.txt

Give each sitemap its own line in robots.txt, or use one sitemap index. Compare the XML elements that identify a child sitemap.

Like it ? share it

Use one Sitemap: line for each sitemap. Give the full URL on each line. If a sitemap index already contains both URLs, one line for the index is sufficient.

Two directories on one site

Suppose two venues use separate directories on the same site. Each venue has its own sitemap. The following two lines can go in the site's root robots.txt file.

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

Keep the protocol and host in both URLs. Google reads the sitemap field independently of the user-agent group. Google's robots.txt specification

One index for both venues

Suppose the site has one index at https://example.com/venues.xml. The index contains these entries.

<sitemapindex xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
  <sitemap><loc>https://example.com/north/sitemap.xml</loc></sitemap>
  <sitemap><loc>https://example.com/south/sitemap.xml</loc></sitemap>
</sitemapindex>

In this case, the following line is sufficient in robots.txt.

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

The XML elements give each URL its meaning. In a sitemap index, each sitemap element identifies a child sitemap. In a urlset, each url element identifies a page. A filename that ends in .xml does not change the type of entry. Sitemaps protocol

Compare the files on your site

  1. Open the robots.txt reader.
  2. Enter the address of your site.
  3. Select FETCH ROBOTS.TXT.
  4. Record the URL from each Sitemap: line.
  5. Open each recorded URL.
  6. For an XML file, identify the root element.
  7. For a sitemap index, compare its child sitemap URLs with the expected addresses.

In an offline test, two XML files contained the same two addresses. The index contained two child sitemap entries. The urlset contained two page entries and zero child sitemap entries. The test read the XML structure only.

To examine the pages inside each child sitemap, use the sitemap audit guide.