Which Pages Can a Sitemap in a Subdirectory Include?

Compare the directory of a sitemap with the paths of its pages. See when submission through Google Search Console changes the directory rule.

Like it ? share it

If one sitemap lists pages across your site, put it at the site root. If it lists only pages under /shop/, you can put it at /shop/sitemap.xml.

By default, the directory that contains the sitemap sets its scope. Google makes an exception when you submit the sitemap through Search Console. Google's sitemap guidelines

Why the slash after shop matters

Suppose your sitemap lists two pages on https://example.com. One page sells hats at /shop/sale/hat. The other gives advice at /shopping/hat.

For a sitemap at /shop/sitemap.xml, compare each path with /shop/. The sale page starts with that directory. The advice page starts with a different directory, although both names start with the same four letters. Sitemaps protocol, file location

One XML file at two addresses

We used one XML file with four full page URLs. All four used HTTPS and the same host. We kept the XML text constant and changed only the address of the sitemap in the test.

Page path Within the scope of /sitemap.xml? Within the scope of /shop/sitemap.xml?
/shop/cart Yes Yes
/shop/sale/hat Yes Yes
/shopping/hat Yes No
/help Yes No

The XML parser read four entries. Both comparisons used those entries. The directory comparison gave a different result for two entries. The test ran offline and used the default directory rule.

Check one page from your sitemap

  1. Open the Enfect sitemap error checker.
  2. Enter the URL of the sitemap.
  3. Select Check sitemap.
  4. Find the XML file that lists the page in a <url> entry.
  5. Record the full URL of that file.
  6. Compare its directory with the path of the page on the same host.

A sitemap index lists other files. For step 4, follow the entry for the file that contains the page URLs. How to read a sitemap index

When Google has a submission record

If you submitted the sitemap through Search Console, open the Sitemaps report for the site. Find the submitted URL. Read its status. Google documents an exception to the directory rule for this submission method.

If you rely on a sitemap link in robots.txt, use the default directory rule for this same-host example. A sitemap at the site root can cover both directories without a change to either page URL.

A submission gives Google a list of URLs to consider. Google can still choose which pages to crawl. Google's submission instructions