跳至正文
技术 SEO 与抓取索引 · Google SEO

Sitemaps for Multiple Subdomains: Cross-Site Setup and API Checks

// / / 光算科技

Multiple subdomains can maintain separate sitemaps or use a central location after the cross-site submission requirements are met. Keep the Search Console property's coverage, the sitemap's hosting address and the URLs listed inside it separate. Hosting a file on the root domain does not automatically authorize it for every subdomain.

Choose the property scope first

Google's property documentation distinguishes Domain and URL-prefix properties. A Domain property covers its domain's subdomains and protocols, subject to verification; a URL-prefix property matches its specified protocol, host and path prefix.

Property exampleCoverageImportant distinction
example.com Domain propertyThe domain, blog.example.com, shop.example.com and different protocolsDoes not cover example.org; adding a property does not change search performance
https://blog.example.com/ URL-prefix propertyThat HTTPS host and URL prefixDoes not automatically cover HTTP or shop.example.com
https://example.com/en/ URL-prefix propertyThat protocol, host and directory prefixUseful for a segment; not coverage of every other directory

You can add URL-prefix properties for separate teams or reporting alongside a Domain property. That is a management choice, not a requirement to create an individual property for every subdomain before Google can discover it.

Option A: keep each sitemap with its own subdomain

A blog can publish https://blog.example.com/sitemap.xml, and a store can publish https://shop.example.com/sitemap.xml. Check that each contains the intended site's URLs and is publicly accessible. Submit through an appropriate Search Console property or declare it in that site's robots.txt.

This often fits independently managed systems and makes it easier to locate a failing generator. It creates multiple files to maintain, but is not inherently a ranking advantage over correctly configured central hosting.

Option B: centralize files with an explicit cross-site setup

Google's current cross-submission instructions provide two routes:

  • Search Console: verify ownership of all sites covered, then create one or more sitemaps containing their URLs. A sitemap index is optional. Check whether the actual verified Domain property's scope covers the intended hosts.
  • Robots.txt: create separate sitemaps for the individual sites, with each file containing only that site's URLs. Host the files in a controlled central location and reference the appropriate file from each individual site's robots.txt.

For example, central files might be https://sitemaps.example.com/blog.xml and https://sitemaps.example.com/shop.xml. These are two separate robots files on two different hosts, not two lines to place only on the apex host:

# https://blog.example.com/robots.txt
Sitemap: https://sitemaps.example.com/blog.xml
# https://shop.example.com/robots.txt
Sitemap: https://sitemaps.example.com/shop.xml

In this robots-based example, blog.xml contains only blog URLs, and shop.xml only store URLs. These illustrative domains have not been submitted or verified by this guide. Listing a sitemap URL inside an ordinary page-level urlset is not a substitute for a proper sitemap index.

Use a real sitemap index, not nested indexes

With cross-site submission configured, this example can be hosted at https://sitemaps.example.com/sitemap-index.xml, with both child files in the same directory:

<?xml version="1.0" encoding="UTF-8"?>
<sitemapindex xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
  <sitemap>
    <loc>https://sitemaps.example.com/blog.xml</loc>
  </sitemap>
  <sitemap>
    <loc>https://sitemaps.example.com/shop.xml</loc>
  </sitemap>
</sitemapindex>

Google's sitemap-index guidance normally requires referenced sitemaps to be on the same site as the index; configured cross-site submission waives that same-site requirement. The guidance also requires child sitemaps to be in the same directory or deeper. A root-level index can make that directory arrangement easier to maintain.

ObjectLimit or condition
Ordinary sitemapAt most 50,000 URLs and no more than 50 MB uncompressed
Sitemap indexAt most 50,000 child sitemap locations; the uncompressed file-size limit also applies
Index submissions in Search ConsoleThe guide lists up to 500 sitemap index files per site
XML contentUTF-8, the correct namespace, fully qualified URLs and required entity escaping
Index hierarchyList sitemap files, not the index itself or another index

The Sitemap protocol makes lastmod optional. In a page sitemap it concerns the page's modification; in an index it concerns the referenced sitemap file. Google's creation guide says significant changes should drive page lastmod values, and that Google ignores priority and changefreq. Gzip compression does not remove the uncompressed-size limit.

API submission has separate property and authorization checks

Search Console sitemaps.submit accepts a property identifier and a sitemap URL, uses PUT without a request body, and returns an empty response body on success.

Field or conditionExample / meaning
siteUrlsc-domain:example.com for a Domain property, or an exact prefix such as https://blog.example.com/
feedpathThe actual file URL, such as https://sitemaps.example.com/blog.xml
OAuth scopehttps://www.googleapis.com/auth/webmasters is required; webmasters.readonly cannot submit
Successful responseAn empty body; not a list of indexed URLs

Pass original values to a client library according to its parameter contract, rather than passing an already encoded whole URL for a second encoding. If constructing the HTTP path directly, encode its parameter components as required by that request format. A Cloud service account or OAuth token does not by itself grant access to a Search Console property.

There is a documentation discrepancy worth handling explicitly: the Sitemaps report instructions require owner permissions, while the user-permissions matrix also marks Submit sitemap for Full users. Use a verified owner for this walkthrough; confirm the actual permission available to another role rather than promising that the scope alone is sufficient.

For automation, retain the property, file URL, request time, HTTP result and error. Investigate authorization failures separately from rate limits or server failures, and avoid replaying confirmed successful submissions. This guide has not performed a live account submission.

Verify file processing and page indexing separately

  1. Fetch the public index and each child file, checking the status and body. A login or HTML error page under 200 is not the intended sitemap.
  2. Parse the downloaded XML and sample page URLs from each host. Check responses, canonical signals, indexing rules and useful entry links.
  3. Use the Sitemaps report for the relevant submission's status and last-read time. Sitemaps found only through robots.txt are not necessarily listed in this report.
  4. Use page-level indexing reports and URL Inspection for the actual pages. Submission, file-reading success, crawling and indexing are separate states.

The sitemap error guide covers fetch and parsing failures; the indexing investigation starts when the file reads but important pages remain absent. Guangsuan's SEO service can include this technical work in the agreed project, with validation based on actual responses rather than universal timing or traffic promises. 中文版:多子域名Sitemap与跨站提交条件。