XML Sitemap Generation and Submission Guide
An XML sitemap is most often mistaken for an indexing switch: put URLs in, submit, wait for indexation. According to the sitemaps.org protocol and Google Search Central documentation, it does exactly one thing — help crawlers discover URLs. Discovery is the first stage of a longer pipeline that also includes crawling, rendering, indexing, and serving; if any later stage is blocked, a perfectly formatted sitemap still produces no indexed pages.
That framing shapes this article. It does not start with how to generate XML. It puts the sitemap back into the pipeline first: what it solves and what it cannot, then answers the more practical question of when you actually need one — plenty of sites do not, or need better internal linking rather than a sitemap. After that come the URLs that must never be listed, structure and protocol limits, automated generation and monitoring, and a closing checklist with common misjudgements.
The standard applied throughout can be stated in one line: the value of a sitemap is proportional to how poorly the site can be discovered on its own. On a shallow site with complete internal linking, marginal value approaches zero; on a deep, large, sparsely linked site, it may be the cheapest improvement available.
1. A hint, not an instruction
1.1 Submission is not indexation: three gates remain
Submitting a sitemap only declares that these URLs exist and that you want them indexed. Three gates can still stop each one.
The first gate is crawl budget. Every site gets a quota of crawl frequency and volume. Slow responses, masses of duplicate URLs, and frequent 5xx errors all divert that quota away from content, so long-tail URLs listed in a sitemap sit at the back of the queue. The allocation logic is in crawl budget management.
The second gate is content quality. Listing a URL does not earn it an index slot. Pages with thin content, heavy overlap with other pages, or no plausible query demand may be crawled and still judged not worth indexing.
The third gate is canonicalisation signals. A sitemap is one signal among many: canonical tags, internal links, redirects, and hreflang all participate in deciding which URL in a group is the canonical one. When those signals contradict each other, the sitemap entry is usually the loser.
1.2 It does not affect the ranking of existing pages
The second thing to state plainly: a sitemap plays no role in ranking. It is not a source of authority. Adding a page does not lift it, and removing it does not drop it — unless, after removal, the page can no longer be discovered at all.
These two points eliminate a whole category of wasted work: endlessly tuning priority, creating a separate sitemap for "important" pages in the hope of a boost, optimising the sitemap as if it were a ranking tool. None of it produces anything. The only metric worth optimising is coverage: of the URLs I submitted, how many were actually crawled and indexed. For diagnosing the whole pipeline, see the website indexation guide.
2. When you actually need one
2.1 Five situations where it genuinely helps
A sitemap solves discovery difficulty, so the test is simply how difficult discovery is for the site.
- New sites: few inbound links, infrequent crawler visits, and pages other than the homepage may go unnoticed for weeks. A sitemap is the fastest way to say "there is a batch of pages here".
- Deep hierarchies: when the distance from homepage to detail page exceeds three or four hops, crawl depth crushes discovery for deep pages, and a sitemap is the shortcut that bypasses the hierarchy. The hierarchy itself still needs fixing — see site information architecture.
- Very large sites: with hundreds of thousands of URLs, covering everything by link traversal is unrealistic; a sitemap is the only discovery channel that scales.
- Rich media and news content: images, video, and news have dedicated sitemap extensions that carry information plain HTML cannot express, and news depends on timeliness — a slow discovery is a lost opportunity.
- Temporarily incomplete internal linking: during a migration, right after a new channel launches, or before a hub is added to the navigation, a sitemap works as a temporary crutch whose importance drops once internal links catch up.
2.2 When you do not need one: near-zero marginal value
Conversely, a small site with complete internal linking — a few hundred pages, two or three levels deep, full navigation — barely needs a sitemap. Crawlers reach everything from the homepage in a few hops, and anything a sitemap would tell them is already available through links.
In that situation it is still worth keeping a basic sitemap, because the cost is trivial and it provides a fallback if internal links get broken, but there is no reason to invest in precise lastmod calculation, priority design, or shard tuning. The return is disproportionate; effort belongs in internal linking and content. For the division of labour between sitemaps and robots.txt — the Sitemap: line being a free discovery channel — see the robots.txt configuration guide.
3. URLs that must never be listed
3.1 Five categories of wrong signals
A sitemap has one content rule: does this URL deserve to appear in search results? If the answer is no, it does not belong. Five regular offenders all violate that rule:
- 404 and 410 URLs: deleted or expired addresses. Listing them means restating every day that a page exists which does not.
- Pre-redirect legacy URLs: every 301 source should be absent. A sitemap must list final destinations only, otherwise crawlers walk the list into redirects one by one.
- Pages carrying
noindex: the page declares it does not want to be indexed while the sitemap recommends it. The two signals point opposite ways. - Duplicates whose canonical points elsewhere: parameter pages, print versions, and multi-path copies belong in this group. They should be consolidated, not promoted.
- URLs blocked by robots.txt: the sitemap invites crawling and robots forbids it, so the crawler just records a refusal.
3.2 Why a wrong entry is worse than a missing one
Including a URL that should not be indexed is not merely ineffective — it is a negative cost. Crawlers walk the list item by item and spend crawl budget on those addresses, and they also treat the sitemap as an input to site quality judgements. A list where a third of the entries are redirects and 404s lowers trust in whatever you submit next.
This is why "auto-generate every URL on the site" is a dangerous default: most CMS generators shovel in tag pages, pagination, search result pages, and author archives. A generator needs filters, not a dump of whatever the database contains. How canonicals relate to those duplicate patterns is covered in canonical and duplicate content.
4. Structure and protocol limits
| Item (sitemaps.org protocol, 2026-08 basis) | Required | Protocol rule or limit | Common misuse and consequence |
|---|---|---|---|
<loc> |
Required | Absolute URL with scheme and host, the final address rather than one that redirects | Relative paths, tracking parameters, or CDN hostnames |
<lastmod> |
Optional | Time of the last substantive change to the page | Stamping the current time on every generation, so crawlers ignore the field wholesale |
<changefreq> |
Optional | Still in the protocol but downgraded to a hint by major engines | Using it to hurry crawling, with no effect |
<priority> |
Optional | Only a relative order inside one site, no cross-site comparability | Tuning it to rank a page higher, which does nothing |
| Single sitemap file | - | At most 50,000 URLs, uncompressed size under 50MB | Exceeding without splitting invalidates the whole file |
| sitemap index | Required once either limit is exceeded | Lists child sitemap addresses, itself bound by 50,000 entries and 50MB | Each nested level raises traversal cost, so one level is normally enough |
4.1 Truthfulness of loc and lastmod
A minimal usable entry needs only one required element:
<url>
<loc>https://example.com/guide/robots-txt</loc>
<lastmod>2026-08-06</lastmod>
</url>
<loc> must be an absolute URL with scheme and host, and it should be the final address rather than one that redirects. Relative paths, tracking-parameter URLs, and CDN hostnames are all wrong.
<lastmod> is optional but has one hard requirement: it must be truthful. It means the time of the last substantive change to the page, not "today". Faking it — stamping the current time on every generation — is the most common self-inflicted wound. Crawlers quickly notice the field disagrees with actual content, learn to ignore it wholesale, and then you lose the signal precisely when you do update something.
4.2 changefreq and priority are now hints
<changefreq> and <priority> remain in the protocol, but mainstream search engines explicitly treat them as hints rather than instructions and largely ignore them for crawl decisions. priority is especially misread: it does not mean "this page matters more than that one", only a rough ordering relative to other pages on your own site, defined by you, with no cross-site comparability.
In practice both can be omitted. If a generator can produce sensible values cheaply, keeping them is harmless, but do not tune them to lift a page's ranking. That is a direct corollary of the rule from chapter 1 that sitemaps carry no ranking weight.
4.3 The hard limits: 50,000 URLs and 50MB
The protocol sets two limits per sitemap file, and both are specification facts:
- a single sitemap may contain at most 50,000 URLs;
- the uncompressed file must not exceed 50MB (gzip transport is accounted separately).
Exceed either and you must split: distribute URLs across several sitemap files and summarise them in a sitemap index. An index file lists only the child sitemap addresses and is itself subject to the same 50,000-entry and 50MB limits. Indexes can nest, but each additional level raises traversal cost, so one level is normally enough.
Split along business structure rather than equal slices of a count: by channel, by content type, by language. The benefit is that submission and indexation status can then be watched per group, and a problem can be traced to a specific group quickly.
5. Generate and update automatically
5.1 Generate from the database or route table
Hand-maintained sitemaps end in a predictable place: three months later they no longer match the site. Generate from the content source instead — a database query, the route table, or publish events from the CMS, any of which can report which URLs currently deserve indexing.
The generator needs three constraints: emit only URLs that meet the indexing standard (excluding non-200 statuses, noindex pages, blocked paths, and anything whose canonical points elsewhere); emit absolute, normalised addresses (consistent scheme, host, trailing slash, and case); and group output into child sitemaps summarised by an index.
5.2 Update lastmod with the content
lastmod must be bound to content change: take the record's "last substantive modification time" field, never the timestamp of the generation job. Get this right and the sitemap stops being just a list and becomes a change notification, letting crawlers prioritise pages that really changed — a genuine crawl efficiency gain for frequently updated sites.
If the content system cannot supply a reliable modification time, omit lastmod rather than invent one. Missing an optional field costs far less than destroying the credibility of the field entirely.
6. Verification and monitoring
6.1 Submission and parsing status
After submitting, look at status before looking at indexed counts. Status carries the critical facts: whether the file is readable, whether it parsed successfully, whether there are format errors, and how many URLs were processed. Parsing failures usually come from encoding, namespaces, XML structure, or exceeded size limits, and they invalidate the entire file — far more serious than a single bad URL.
For multi-engine submission, the Bing-side entry point and how to read its status are covered in the Bing Webmaster Tools guide. The two need not agree exactly, but neither should sit permanently in an unreadable state.
6.2 Three comparison lines
Monitoring is fundamentally comparison, and three lines cover most problems.
Line one: the gap between sitemap entries and indexed pages. A stable gap in a reasonable range is normal, since not every page deserves indexing; a sudden widening means a newly submitted batch is low quality, or the site just had an incident.
Line two: URLs listed in the sitemap that return non-200. Run a full comparison periodically, pull those URLs out, and confirm for each whether the generator missed a filter or the content was genuinely deleted. This line catches the most common generator defect.
Line three: the share classified as discovered but not indexed. A sustained rise here usually points at crawl budget or content quality, not at the sitemap itself. For how to read and fix each class, see the Search Console coverage report.
7. Checklist and common misjudgements
Work through in order; each item can be confirmed in under half an hour.
- The sitemap is publicly reachable, returns 200, and serves XML or plain text.
- Every
<loc>is an absolute, normalised final address rather than a redirect. - The list contains no 404 or 410 URLs, no
noindexpages, and no robots-blocked paths. lastmodcomes from content modification time, and ten spot-checked entries match the pages.- No file exceeds 50,000 URLs or 50MB, and anything beyond that is summarised by a sitemap index.
- Submission status is successful and the processed URL count matches expectations.
- A minimal version of all three comparison lines exists: count gap, non-200 list, and the not-indexed share.
Five common misjudgements, all cases of knowing the rules but reading them wrong:
- Treating the sitemap as an indexing switch. Submission affects discovery only; indexation depends on crawl budget, content quality, and canonicalisation signals.
- Treating priority as a ranking parameter. It is a hint, and raising it grants nothing.
- Refreshing lastmod on every generation. The field gets ignored wholesale and stops working when it matters.
- "Auto-generate everything" without filters. Tag pages, pagination, and search pages flood the list and burn crawl budget in reverse.
- Relying on the sitemap while internal links stay broken. A sitemap is a crutch; the site's own link structure is the durable discovery mechanism.
One closing judgement: correctness of a sitemap can be verified with tools, but its necessity can only be judged from structure. If a page is reachable only through the sitemap, the problem is in the link structure, not in how well the sitemap is written — walk the technical SEO checklist item by item and the root cause usually surfaces.
Source: the sitemaps.org protocol and the official Google Search Central documentation on building sitemaps, compiled and interpreted by 16IDC.
Integration & Code Examples
Example 1: A protocol-conformant sitemap
<?xml version="1.0" encoding="UTF-8"?>
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
<url>
<loc>https://www.example.com/</loc>
<lastmod>2026-11-01</lastmod>
</url>
<url>
<loc>https://www.example.com/blog/example-post</loc>
<lastmod>2026-10-28</lastmod>
</url>
<url>
<loc>https://www.example.com/pricing</loc>
<lastmod>2026-09-15</lastmod>
</url>
</urlset>
loc must be an absolute URL matching the canonical exactly, and lastmod should change only when the content really changes — refreshing it every build makes the field meaningless.
Example 2: Validate with xmllint and check fetchability with curl
# 1) Structure: well-formed first, then against the XSD (use a local XSD offline)
xmllint --noout sitemap.xml
xmllint --noout --schema sitemap.xsd sitemap.xml
# 2) Entry count and duplicate URLs
xmllint --xpath 'count(//*[local-name()="url"])' sitemap.xml; echo
grep -o '<loc>[^<]*</loc>' sitemap.xml | sed 's/<[^>]*>//g' | sort | uniq -d
# 3) Fetchability: status, content type, and whether robots.txt allows it
curl -sSI https://www.example.com/sitemap.xml | grep -i 'HTTP/\|content-type'
curl -sS -o /dev/null -w 'robots=%{http_code}\n' https://www.example.com/robots.txt
A sitemap is only usable when all three hold: it parses, it can be fetched, and it has no duplicates.
Limitations
- Adding a page does not lift it, and removing it does not drop it — unless, after removal, the page can no longer be discovered at all.
- Listing them means restating every day that a page exists which does not.
- A sitemap must list final destinations only, otherwise crawlers walk the list into redirects one by one.
- Pages carrying
noindex: the page declares it does not want to be indexed while the sitemap recommends it. <lastmod>is optional but has one hard requirement: it must be truthful.
FAQ
Which three comparison metrics matter after submitting?
Check 3 lines: submitted-versus-indexed gap, the non-200 list, and the discovered-but-not-indexed ratio. A stable gap is normal while sudden widening means a bad new batch. The second catches generator filtering bugs, and the third points to crawl budget or content quality. Watch all three weekly so drift shows up early.
When not to list a URL in a sitemap?
Avoid 5 types: 404 and 410 pages, pre-redirect addresses, noindex pages, duplicates whose canonical points elsewhere, and anything blocked in robots.txt. Listing them spends crawl budget backwards and lowers crawler trust in what you submit next, so check each one against the generator filter.
Is a sitemap worth keeping on a well-linked site?
Keep 1 basic file. It costs almost nothing and covers you if internal links break. Skip lastmod precision and priority tuning, since the return does not match the effort. Spend the time on links and content, splitting files only when depth and volume demand it.
Related Providers
- Google Search Console: when a submitted sitemap must be compared by indexed versus discovered counts.
- Bing Webmaster Tools: when URLs are pushed through IndexNow and index status is checked afterwards.
Community & Resources
-
SEO Optimization: other coverage in this category.
Official docs and communities -
sitemaps.org protocol — The authoritative definition of format, namespace and limits.
-
Google sitemap overview — Scope of sitemaps and when one is genuinely needed.
-
Build a sitemap — Generation rules, size limits and sitemap index files.
-
robots.txt introduction — The part that most often conflicts with sitemap strategy.
Learning resources and tools
- Google Search Central documentation — The official path for crawling and indexing issues.
- Bing Webmaster Tools — The other major submission and diagnostics entry point.
- Stack Overflow sitemap tag — Practical questions on generating, splitting and validating.
- MDN HTTP overview — Reading curl headers and status codes with confidence.
Original source: Google Search Central ↗