An XML sitemap is a machine-readable list of URLs that a site wants search engines to discover or revisit. It can be especially useful when a site is large, newly launched, frequently updated, or has pages that are not easy to reach through internal links. But a sitemap is a discovery signal, not a promise that every listed URL will be crawled or indexed. A sitemap audit checks whether the file is valid, accessible, aligned with canonical and indexation policy, and useful to the people maintaining the site.
This guide walks through a practical audit from robots.txt and Search Console to URL-level validation, sitemap index files, `lastmod`, international annotations, and release monitoring. The aim is to find concrete errors such as redirected or blocked URLs, stale dates, duplicates, malformed XML, missing pages, and a submitted sitemap that does not match the site’s intended indexable inventory. Treat each issue as a data problem to reproduce, not as proof of a ranking drop.
What an XML Sitemap Does
An XML sitemap describes URLs and optional metadata using the sitemap protocol. At minimum, each URL entry contains a location. A file may also include a last modification timestamp and supported extensions for images, video, news, or language alternates. The sitemap helps search engines discover URLs and understand when important content changed, but it does not replace crawlable internal links, a sound site architecture, or correct page responses.
Google can use `lastmod` when it is consistently accurate and verifiable. It should reflect a significant change to the page, such as main content, structured data, or links, rather than a routine footer date. Google ignores `priority` and `changefreq`; adding them does not make a crawler visit a URL sooner. Avoid spending time tuning unsupported fields while canonical, response, or XML errors remain.
Decide Which URLs Belong in the Sitemap
Define the sitemap’s intended inventory before checking the XML. Usually, include the preferred canonical version of pages that you want eligible for search. Exclude URLs that are blocked from crawling, marked noindex, redirected elsewhere, non-canonical duplicates, error pages, temporary sessions, internal search results, and parameter variants that do not represent distinct landing pages. Keep the inclusion policy aligned with the site’s robots, canonical, internal links, and metadata.
| URL condition | Typical sitemap decision | What to verify |
|---|---|---|
| Canonical, indexable 200 page | Include if intended for search | Page content, canonical, status, internal links |
| Redirecting URL | Replace with the final destination | Redirect target and final response |
| Noindex page | Exclude | Robots meta or X-Robots-Tag and crawl access |
| Duplicate with canonical elsewhere | List the selected canonical only | Canonical consistency across page and sitemap |
| 404 or 5xx URL | Exclude until repaired or intentionally restored | Actual HTTP status and application behavior |
| Temporary parameter or session URL | Exclude | Stable URL and internal link policy |
A sitemap is not a substitute for fixing discoverability. Google recommends that important pages be reachable through links from pages it can find. Compare sitemap URLs with a crawl of your site and the database or CMS inventory. Missing URLs may be unlinked, filtered out by an export rule, or not intended for indexing. Decide which explanation applies before adding them.
Find Every Sitemap and Submission Path
Start at the site’s robots.txt and record each `Sitemap:` directive. Then inspect the sitemap submitted in Search Console and any sitemap index it references. A site can publish multiple sitemap files for content types, languages, or URL groups. Also look for static sitemap files, CMS-generated endpoints, CDN copies, and legacy files left from a migration. Make sure the file tested in the browser is the same one being submitted and served to crawlers.
For large sites, a sitemap index can list child sitemap files. Use the supported hierarchy and file size limits, and ensure each child URL is accessible. The sitemap index’s `lastmod` refers to when the child sitemap itself changed, not when one of its page URLs changed. Group files by a clear rule, such as content type or language, so the team can isolate errors and understand coverage.
Check HTTP Access Before Parsing XML
Request each sitemap URL directly and record status, final URL, content type, response size, and redirect chain. A sitemap should be available to crawlers without authentication. Check that HTTPS certificates are valid and that the hosting layer does not serve an HTML error page with status 200. Inspect the raw response rather than relying only on a browser that may format XML or hide headers.
Common access problems include robots.txt blocking the sitemap itself, CDN rules that deny crawler requests, a redirect loop, stale cache, an expired file, wrong content type, and a generated response that is truncated. If the sitemap is compressed, confirm that it decompresses and parses. Validate every child sitemap listed by an index, not just the index document.
Validate XML Structure and URL Values
Parse the file with an XML parser or sitemap validator. Check that the document uses the sitemap namespace, properly closed tags, valid entity escaping, and correctly formed URLs. XML characters such as ampersands in query strings must be escaped. Each location should be an absolute URL using the intended hostname and protocol. Watch for staging domains, HTTP URLs on an HTTPS site, URL encoding mistakes, duplicate entries, and whitespace added by a template.
Do not rely on line count alone. A sitemap may be valid XML while listing unsuitable URLs. Parse every `loc` value and compare it with the expected URL inventory. For each entry, classify status, final URL, canonical target, indexability, lastmod, language, and sitemap source. A crawler such as a site audit tool can fetch the list and surface status codes, but spot check important URLs independently.
Respect the sitemap protocol limits
Sitemaps have per-file URL count and uncompressed file size limits. If a file grows beyond the documented limit, split it and use an index. Count URLs after generation, not only source records, because one record may expand into language variants or image entries. Check gzip output size and uncompressed size separately where the implementation requires it. Do not create many tiny files without a useful grouping rule.
Compare Submitted URLs with Canonical and Indexing Signals
For each sample URL, compare the sitemap location to the final response and the page’s declared canonical. The URL should resolve to the preferred version, not redirect to another URL or point its canonical elsewhere without a reason. Look for mixed signals: an HTTP URL in the sitemap with an HTTPS canonical, a trailing slash mismatch, a language variant pointing to another language, or a noindex page still submitted.
Use Search Console’s Sitemaps report to see whether Google could fetch and process the submitted file and how many URLs were discovered. A discovered count is not an index count. Use the Page indexing report and URL Inspection for indexing questions. If the sitemap is processed but pages are excluded, diagnose the page-level reason rather than repeatedly resubmitting the same unchanged file.
Audit `lastmod` for Accuracy
Check whether the generator derives `lastmod` from a meaningful modification timestamp. It should change when the page’s main content, structured data, or important links change. It should not be set to the current time on every sitemap request, because that makes the field untrustworthy and may cause unnecessary recrawling signals. It should not remain frozen after substantial editorial updates.
Compare a sample of sitemap dates with CMS update history or repository release records. Ensure time zones are converted consistently and the chosen W3C date-time format parses correctly. If the site cannot provide reliable modification times, it is better to omit an inaccurate optional field than to generate fabricated recency. Date metadata is useful only when it reflects real change.
International and Alternate URL Data
Sites with language or regional variants can provide alternate links through HTML annotations or sitemap extensions. Check that each variant points to the corresponding page, that reciprocal relationships are complete when required, and that URLs return the expected language. A translation pair should not be represented as if both URLs were the same canonical when they serve different language users.
Keep alternate annotations consistent with page-level hreflang and canonical signals. A sitemap does not repair an incorrect language mapping. Use the same preferred URLs across the sitemap, canonical, and alternate references, and verify them after domain changes or locale migrations. For a separate process to diagnose language annotations, consult our hreflang audit guide.
Common Sitemap Errors and How to Fix Them
| Finding | Likely cause | Action |
|---|---|---|
| URL not allowed | robots.txt blocks the path | Confirm intent; update robots rule or remove the URL |
| Submitted URL redirects | Old URL retained after a migration or protocol change | Replace it with the final canonical URL |
| Submitted URL marked noindex | Generator ignores indexability | Fix the export filter and inspect template directives |
| 404 or soft 404 | Deleted page or empty content returned as success | Restore useful page or remove it and fix internal links |
| Server error | Origin, CDN, or application failure | Resolve availability issue and retry the same URL |
| Invalid XML | Unescaped character, malformed tag, encoding issue | Fix serialization and validate the raw output |
| Discovered but not indexed | Page quality, duplication, demand, or crawl issue | Inspect the page; sitemap submission does not force indexing |
| Many duplicate URLs | Multiple generators or inconsistent normalization | Consolidate output and standardize canonical URLs |
Work from the error category to representative URLs. If only one template is affected, fix the generator or route for that template instead of editing the XML manually. If a file is too large or split incorrectly, update the sitemap generation rule. If URLs are valid but not indexed, review page usefulness, canonical choice, internal links, and technical access. Keep a record of the root cause and the validation performed.
Build a Repeatable Sitemap Audit
- Inventory sitemap URLs from robots.txt, Search Console, sitemap indexes, CMS endpoints, and legacy files.
- Fetch each file and record HTTP status, final URL, content type, and retrieval date.
- Parse raw XML and validate namespaces, URL values, escaping, size, and file count limits.
- Compare `loc` entries with the intended indexable canonical URL inventory.
- Fetch representative pages and check status, canonical, robots, language, and internal links.
- Validate `lastmod` against actual significant updates.
- Inspect Search Console processing and page indexing reports separately.
- Fix the source generator or rule, regenerate, and repeat the same comparison.
- Monitor after deployment and remove stale or redundant sitemap submissions.
Keep the audit reproducible. Store a date-stamped report with counts by sitemap, status, canonical mismatch, noindex, duplicate, language, and lastmod quality. Include sample URLs and the exact rule that produced each classification. Separate “not in sitemap” from “not indexed”; they describe different states and need different owners.
Frequently Asked Questions
Does adding a URL to a sitemap guarantee indexing?
No. A sitemap helps search engines discover and understand URLs, but Google does not promise to crawl or index every listed page. Page quality, duplication, canonical selection, access, and other systems still matter.
Should redirected URLs stay in the sitemap?
Usually no. Replace them with the final preferred URL and make sure that destination returns the expected response and canonical.
How often should I update the sitemap?
Generate it when meaningful URLs or page content change. The file can be generated dynamically, but values such as `lastmod` should reflect real significant changes rather than the request time.
Does the `priority` field improve rankings?
No. Google ignores `priority` and `changefreq`. Focus on valid URLs, accurate `lastmod`, and consistent indexing signals.
What if Search Console says a sitemap was fetched but few pages are indexed?
Fetching confirms that Google could process the sitemap file, not that every URL should be indexed. Inspect affected pages in Page indexing and URL Inspection, then check quality, canonical, robots access, and response status.
Can I submit multiple sitemap files?
Yes. Sitemaps can be grouped and listed in an index file, within the published protocol limits. Keep each group clear and make sure every child file is accessible.
Conclusion
A reliable sitemap is a clean, current list of canonical URLs that the site wants search engines to consider. Audit access, XML syntax, URL eligibility, redirects, robots and noindex rules, language alternates, and modification dates together. Fix the generator where possible, verify representative pages, then review Search Console processing separately from indexation. Treat sitemap submission as one part of discoverability, supported by useful content and crawlable internal links.
For primary guidance, see Google’s documentation on building and submitting sitemaps (Opens in a new tab), sitemap index files (Opens in a new tab), and Search Console reports (Opens in a new tab). Use the protocol requirements alongside the URLs and status data from your own site.
Post a comment
Please log in to leave a comment. Login