A sitemap gives a collector a useful list of candidate URLs. It does not prove that the list contains every relevant page, that every listed page is accessible, or that each advertised modification date is accurate.

I would use a sitemap as a documented discovery input: identify its type, validate its scope, preserve where each candidate came from, and reconcile that list with fetch and record outcomes. This is especially useful when a project needs an explainable collection inventory rather than an uncontrolled traversal of every link on a website.

This workflow is for authorized collection. The Sitemaps protocol defines the file format and its metadata; it is not a data-access license or a completeness guarantee. Evaluate candidate URLs under the project's scope, site rules, and access agreement before dispatch.

First distinguish a sitemap from a sitemap index

A normal XML sitemap uses a urlset root containing url entries. A sitemap index uses a sitemapindex root containing sitemap entries. Treating an index's loc values as page URLs can send XML files to a page parser and create misleading “successful page” counts.

Input elementWhat it identifiesWhat to do next
urlset/url/locA candidate page URLValidate and consider it for the page queue
urlset/url/lastmodClaimed modification time of that pagePreserve it as a scheduling hint with its source
sitemapindex/sitemap/locA child sitemap locationSchedule a bounded sitemap-fetch task
sitemapindex/sitemap/lastmodModification time of the sitemap fileConsider whether that child file needs another retrieval
changefreqA publisher-provided frequency hintDo not convert it into a guaranteed update schedule
priorityRelative importance within the publisher's siteDo not treat it as cross-site importance or collection quality

Here is a small illustrative sitemap, not a real website inventory:

<?xml version="1.0" encoding="UTF-8"?>
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
  <url>
    <loc>https://example.com/catalog?item=12&amp;lang=en</loc>
    <lastmod>2026-11-20</lastmod>
  </url>
  <url>
    <loc>https://example.com/catalog?item=12&amp;lang=fr</loc>
  </url>
</urlset>

Use a namespace-aware XML parser. The loc value returned by that parser contains &, because &amp; is XML escaping. Do not send the literal XML escape sequence as part of the URL, and do not repeatedly unescape the result until it appears simpler. The English and French URLs are distinct candidates unless your task has established otherwise.

Obtain an approved discovery starting point

Use a sitemap location provided by the site owner, an approved integration, or an applicable robots.txt declaration. Record that starting point and how it was established. Avoid inventing an unlimited list of sitemap filenames and probing them across hosts.

The protocol describes normal same-site location rules and an explicit cross-submission mechanism in which a host's robots.txt points to a sitemap hosted elsewhere. Therefore, “every cross-host sitemap is invalid” is too broad. Equally, a URL appearing inside XML is not enough to approve a new fetch destination.

Keep explicit approved origins for sitemap retrieval and page retrieval. Validate redirects too. A namespace declaration is an identifier used to interpret the XML, not an instruction to fetch that namespace URL. Disable unneeded external resource resolution in the parser and bound decompression, memory, and the number of child files your importer can process.

Put limits on both file size and queue expansion

The Sitemaps protocol permits up to 50,000 URLs in a sitemap and an uncompressed size of up to 52,428,800 bytes. A sitemap index has its own corresponding limits on listed sitemaps and file size. Gzip compression does not remove the uncompressed-size requirement.

These are protocol limits, not an obligation to accept that much input into every small diagnostic tool. A smaller project importer can set stricter documented limits, but should report “rejected by importer limit” rather than mislabelling every such file as protocol-invalid.

Set separate bounds for response bytes, decompressed bytes, entries per file, number of files per job, and elapsed job time. Track visited sitemap URLs to avoid refetch loops, duplicate declarations, or accidental recursive expansion. Accept only the formats your importer implements; the protocol also discusses text and feed formats, which should not be handed to an XML-only parser.

For unusually large approved files, use the safe download and integrity workflow where its assumptions hold. Correct transfer is still only the first stage: parsing and candidate acceptance remain separate.

Treat lastmod as a claim to verify

For page entries, lastmod should describe when the linked page changed, not when the sitemap was generated. For an index entry, it describes the child sitemap file. Neither field is a substitute for a server validator or a measurement of when your collector last obtained useful data.

Preserve three separate values: the publisher's advertised lastmod, the time you discovered the entry, and the time you successfully fetched and validated the page. They answer different operational questions.

If every entry receives a fresh timestamp whenever a sitemap is regenerated, a lastmod-only scheduler may refetch unchanged pages. If timestamps never change, it may miss updates. Use a small authorized verification sample before relying on the hint. Where supported, conditional HTTP requests provide a separate mechanism for revalidating saved representations.

An omitted or malformed lastmod should not automatically delete the candidate. Record the issue and schedule using a fallback appropriate to the source contract. Do not invent midnight timestamps to make every row appear complete.

Build a ledger that explains missing coverage

The output of discovery is a candidate ledger, not a completed dataset. I would preserve enough information to reconcile these stages:

1. The sitemap files declared for the run. 2. Which files were retrieved, parsed, rejected, or unresolved. 3. The raw URL entries and unique accepted candidates. 4. Candidates excluded by scope or site policy. 5. Pages attempted, pending, failed, or successfully retrieved. 6. Records that passed the business acceptance checks.

For each candidate, keep its source sitemap, discovery run, advertised modification value, request-context identifier, and queue decision. If multiple sitemaps list the same URL, retain the provenance while avoiding duplicate dispatch for the same task context.

Do not calculate “full website coverage” from the number of sitemap URLs fetched. If a run discovers 800 accepted candidates and validates 760 of them, the useful statement is about that discovered candidate set. It says nothing by itself about unlisted pages, unpublished variants, or every product in the business catalog. These numbers are an illustration, not measured results.

For pages that still need an API or browser to obtain the required fields, dynamic data collection and pagination is a downstream task. Discovering a detail URL does not remove those extraction requirements.

Do not infer deletion from one missing entry

A URL can disappear because a child file failed, a sitemap was regenerated incompletely, or the publisher changed which pages it advertises. Mark the observation first. Before deleting stored data, confirm that the inventory run was complete under your defined scope and obtain an appropriate deletion signal or source agreement.

A practical record lifecycle can distinguish “not seen in this run,” “confirmed removed,” and “temporarily inaccessible.” The exact transitions are project rules, not requirements supplied by the Sitemap protocol.

If the importer receives HTML instead of XML, inspect media type and final destination before changing parser settings. The response-decoding diagnosis guide explains why HTTP 200 does not prove that the expected document arrived.

This article describes a protocol-based import and acceptance workflow. Its XML snippet is illustrative; it is not a production sitemap importer, a live-site coverage test, or a search-indexing submission guide.

Frequently asked questions

Does being listed in a sitemap override robots rules?

No. Discovery and permission are separate. Apply the relevant rules and project authorization before requesting the listed page.

Can an index lastmod tell me which product changed?

Not directly. It refers to the sitemap file. Parse the child inventory and inspect page-level hints or actual page responses to identify candidate changes.

Should URLs with missing lastmod be ignored?

Not by default. The field is optional. Retain the candidate and use a documented scheduling fallback if it is in scope.

Is a sitemap sufficient to prove every page has been collected?

No. Reconcile the declared sitemap files and the accepted candidate set, and describe that denominator precisely. Additional owner-provided inventories or agreed completeness criteria are needed for broader coverage claims.

About the author

陈序 is a virtual editorial author focused on proxy product selection and application analysis, translating task requirements into clear acceptance criteria and practical trade-offs.

Expertise: Proxy product selection; application fit; plan and billing conditions; trial acceptance; long-term operating requirements.