Currently if you have multiple chunks in a sitemap, you currently get sitemap pages like these:
http://example.com/sitemap.xml
http://example.com/sitemap-1.xml
http://example.com/sitemap-2.xml

Note we can't do thing like http://example.com/sitemap.xml/1, etc since as per the specification, links in a sitemap page must not be *above* the location of the sitemap they're in.

Because of this we also have to have special menu items for *each* and *every* sitemap chunk:

  $items['sitemap.xml'] = array(
    'page callback' => 'xmlsitemap_output_chunk',
    'access arguments' => array('access content'),
    'type' => MENU_CALLBACK,
    'file' => 'xmlsitemap.pages.inc',
  );
  $chunks = xmlsitemap_get_chunk_count();
  if ($chunks > 1) {
    for ($i = 1; $i <= $chunks; $i++) {
      $items['sitemap-' . $i . '.xml'] = array(
        'page callback' => 'xmlsitemap_output_chunk',
        'page arguments' => array((string) $i),
        'access arguments' => array('access content'),
        'type' => MENU_CALLBACK,
        'file' => 'xmlsitemap.pages.inc',
      );
    }
  }

I'm not sure why I didn't think of this before, but I'm not sure why we can't just use a 'page' query parameter like this:
http://example.com/sitemap.xml
http://example.com/sitemap.xml?page=1
http://example.com/sitemap.xml?page=2

Pros:
- We only need one default menu item to cover all possible sitemap pages.
- We don't need to run a menu rebuild whenever the number of sitemap pages changes.
- Flexible for changes if we need multiple contexts like languages/domains

Cons:
- Not exactly sure if it would be compatible with search engines, but I can't find anything to say it wouldn't.

Comments

dave reid’s picture

dave reid’s picture

Initial patches for D6 and D7 attached.

dave reid’s picture

I'm testing this on my own site since I can't seem to get a good answer from anyone at Google. I really wish I had a person I could contact that knew about the specifics of Google Webmaster Tools.

dave reid’s picture

Just submitted to Webmaster tools and it was fine. I think I'm going to go ahead with this change.

dave reid’s picture

Status: Active » Fixed

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.