We had two sitemaps declaring the same 180 URLs. Both returned 200. Both were valid XML. Both were, from Google's point of view, redundant copies of each other — and we only found out because a URL count did not add up.
The arithmetic that exposed it
The sitemap index listed 12 child sitemaps. Adding their <loc> counts gave 11,236 URLs. But we also had a hand-built /collections-sitemap.xml sitting in the root, registered in Search Console months earlier, listing 180 collection pages.
Those 180 pages were the same 180 pages. The taxonomy-based provider inside wp-sitemap.xml was already emitting them, and the standalone file was emitting them again, with slightly different <lastmod> values because they were generated at different times.
A crawler that hits both files sees 180 URLs twice with conflicting timestamps. The best case is wasted crawl budget. The realistic case is that the conflicting lastmod makes the crawler distrust lastmod across the whole site, which is the one signal that actually gets new pages fetched.
Why the standalone file existed
It predated the taxonomy provider. When the collection pages were first built from two taxonomies — brand plus category, 141 pages at the time, 180 now — WordPress had no provider for them, so a plugin generated a static XML file on a cron.
Then we added a proper provider so the collections would appear inside the standard index. We never removed the old file. Classic.
The fix had a constraint
We could not just delete /collections-sitemap.xml. It has been submitted in Search Console since before the provider existed, and Search Console keeps a per-sitemap history: removing a file that is explicitly submitted turns into a "couldn't fetch" error in the Sitemaps report, which looks like a site problem in a report a human reads.
So we kept the standalone file and removed the duplicate from the index:
add_filter('wp_sitemaps_add_provider', function ($provider, $name) { return $name === 'collections' ? false : $provider; }, 10, 2); One filter, index drops from 12 children to 11, and /collections-sitemap.xml keeps serving its 180 URLs to the submitted record. Two entry points, one owner each.
Verifying a sitemap change is harder than making it
Three traps, all of which we hit.
Cache. The index and every shard are nginx-cached HTML (well, XML) with a long TTL. After the filter went in, wp-sitemap.xml still showed 12 children for a while. We had to purge the index and each shard path individually before the change was observable. If you check once and see the old value, you have learned nothing.
Counting. grep -c '<loc>' returns 1 on a single-line XML document, because grep counts lines, not matches. Every WordPress sitemap is one line. Use grep -o '<loc>' | wc -l. We have written the wrong number into a report at least twice because of this.
The GSC number lags by days. Search Console reported 10,048 URLs for a sitemap that was serving 11,236. That is not an error; it is a cached read from the last time Google fetched the file. Comparing the two numbers and concluding something is broken is a mistake we made in week one.
The resulting structure
| Sitemap | URLs | Role |
|---|---|---|
wp-sitemap.xml (index) | 11 children | canonical entry point |
wp-sitemap-posts-product-1..6.xml | 10,941 | products, 6 shards after quality filter |
wp-sitemap-posts-post-1.xml | 22 | guides and articles |
wp-sitemap-posts-page-1.xml | 20 | static pages |
wp-sitemap-taxonomies-product_cat-1.xml | 41 | category archives |
wp-sitemap-brands-1.xml | 29 | brand hubs |
collections-sitemap.xml | 180 | collections, standalone, submitted separately |
Total inside the index: 11,056. Plus the 180 that now have exactly one owner.
The transferable rule
If a URL can be reached from two sitemaps, one of them is lying about lastmod. Pick an owner per URL set, and if you cannot delete the loser because a search engine has history with it, at least take it out of the index so new crawls only meet it once.
This is the same class of bug as having the same product reachable at /product/slug/ and /product/slug-2/, or a category at two paths. It does not break anything visibly. It just makes every freshness signal on the site slightly less believable, and freshness is the only lever a catalogue this size has.
The 180 collection pages are the ones that group things like shoulder bags, sneakers and the size guides by brand and type. Example of a single product page inside them: Birkin 25 in black Togo. 30-day returns, duties prepaid, WhatsApp checkout.