Generate Sitemap: Build XML, Then Sample Audit
By the SEO Health Team · Last updated: 2026-08-16 · We build the SEO Health checker at aimeetup.center. Methods below come from the product’s page audits, sitemap samples, and GSC export math — not from a claimed Google score.
Table of Contents
- TL;DR
- What the job means in 2026
- What belongs in the file
- How to build the XML
- Validate before you celebrate
- Immediately sample 50–500 pages
- Tool landscape
- Implementation steps
- Failure modes
- Frequently Asked Questions
- Conclusion
TL;DR
Direct answer: To generate sitemap XML is to publish a well-formed list of canonical, indexable URLs so crawlers can discover them. The 2026 finish line is not the file. Validate it, then audit a stratified sample of 50–500 pages before you call the inventory done.
What you'll learn
- A 42-word definition of generate sitemap work you can quote
- Which URLs belong in the file, and which junk rows waste crawl budget
- CMS, script, and sitemap-index ways to build the XML
- How to validate markup, size, and HTTP status before you submit
- Why the next step is a 50–500 page sample, not a million-URL crawl
If the file is already live, run a sampled site audit. Paste the host. Let the checker parse the map and draw pages from each bucket. A generate sitemap click that stops at “file written” leaves the real defects unread.
What the job means in 2026
Key Definition: A generate sitemap job is the act of publishing a well-formed XML list of canonical, indexable URLs so crawlers can discover them. In 2026 the useful finish is not the file itself: validate it, then audit a stratified sample of 50–500 pages.

Quick answer: Publishing well-formed XML means listing canonical, indexable URLs so crawlers can discover them. The 2026 finish line is not the file. Validate it, then audit a stratified sample of 50–500 pages. Key terms
| Term | Meaning |
|---|---|
| XML sitemap | The crawler-parseable inventory of canonical URLs. |
| Sitemap index | A list of sitemap files used when one file would exceed the size cap. |
| lastmod | The date the content last changed in a way a crawler should care about. |
| Stratified sample | A 50–500 URL draw on this page that respects locale and type buckets. (#571) |
People type generate sitemap when a CMS promised a plugin, a new locale shipped without a child file, or Search Console still shows “couldn’t fetch.” Those are build jobs, not ranking jobs. The Wikipedia site map article still separates a human navigation page from the machine-readable inventory crawlers parse.
The method that sits around the file — size, lastmod honesty, locale versus column — lives in Sitemap for SEO. This page stays on how you generate sitemap XML, then what you must do in the same sitting. If you only need the beginner picture, start at What Is a Sitemap?.
Key definition, in practice
A useful generate sitemap output is a fetchable urlset or a sitemap index that points at child urlset files. Each <loc> should be the canonical you want discovered. lastmod should be the date the content changed. Priority and changefreq are optional; do not decorate them.
Generation is not the finish line
Teams treat “XML exists” as done. Crawlers then spend budget on faceted filters, thank-you pages, and expired campaigns the CMS cheerfully exported. The file can be valid and still be a bad inventory. After you generate sitemap markup, the next hour is validate → sample → read four reports. That order is the whole tutorial.
What belongs in the file
List every canonical, indexable, 200-OK URL you want discovered. List nothing else. There is no bonus for a longer file. A bloated generate sitemap export is how crawl budget disappears into parameter URLs you will never want in the index.
Canonical, indexable, 200-OK only
Google’s build a sitemap document is the right first spec: include URLs you want crawled, keep each file under 50,000 URLs and 50 MB uncompressed, and split with an index when you exceed that. If two addresses resolve to one article, list one. If a path is noindex, leave it out. If a path redirects, list the destination, not the hop.
When you generate sitemap rows from a database, filter on the same rules the template uses for rel=canonical and robots. A nightly job that dumps every pages row will reintroduce junk you already cleaned in the UI.
What to leave out
Omit account, cart, checkout, search-result, print-view, and staging hosts that leaked into production. Omit faceted duplicates unless a facet is a real landing page with unique copy. Omit paginated archives if the first page already covers the set. Operational cadence for those cuts sits in XML Sitemap Best Practices. A generate sitemap plugin that cannot exclude those paths is the wrong plugin.
How to build the XML
There are three honest ways to generate sitemap files in 2026: the CMS plugin, a build-time script, and a sitemap index that shards a large set. Pick the one that reads the live canonical set, not a cached guess.
CMS plugins and static-site builders
WordPress, Shopify, and most static generators will write /sitemap.xml or an index at /sitemap_index.xml. Turn the feature on, then open the file. Confirm it lists the URLs you ship, not every attachment, tag, and author archive.
A generate sitemap toggle is not a review. Spot-check twenty <loc> values in a browser. If five of them 301, the plugin is reading the wrong field.
Scripts when the CMS is wrong
When the CMS lists junk, write the file from the same query that powers navigation: published, canonical, public, 200. The Sitemaps protocol is small: a urlset, a loc, optional lastmod, UTF-8, well-formed tags. Gzip is fine. Do not invent extra namespaces the parser will ignore.
If you generate sitemap XML in CI, fail the build when a listed URL is off-host or when the uncompressed size crosses 50 MB. A script that cannot fail is a pretty printer.
Sitemap index when you exceed the cap
Sites that outgrow one file should split by locale, content type, or publish week — then publish an index that lists the children. Update the index when a child is added or retired. A generate sitemap program that writes one giant blob and hopes the fetch finishes is how Search Console starts warning.
Declare the absolute file location in robots.txt (Sitemap: https://example.com/sitemap.xml). The Robots Exclusion Protocol is the document crawlers use for that line. Path and “file not found” problems live in Sitemap URL. Fix the declaration before you argue about titles.
Validate before you celebrate
Validation is a short gate. Skip it and you will sample a file that does not parse, or a file that parses and lists 404s.
Well-formed markup and size
Confirm the document is well-formed XML, the encoding is declared, and you are under the size cap. Search Console will surface fetch errors. After you generate sitemap output, open the raw file once. If the first tag is an HTML error page, you published a route, not a map.
Spot-check HTTP status
Pick twenty URLs from different folders. Request them. You want 200. A 301 means you listed a hop. A 404 means the inventory is stale. A 503 means you sampled during a deploy. MDN’s HTTP status reference is enough to classify those codes. RFC 9110 is the semantics underneath: a listed URL should be a successful, cacheable representation of the canonical page, not a soft error dressed as 200.
If more than two of the twenty fail, do not submit. Fix the query that you use to generate sitemap rows. Then rebuild once.
Immediately sample 50–500 pages
This is the step most generator tutorials omit. SEO Health parses the map and draws a stratified sample of 50–500 pages. We are not a desktop crawler. We do not walk a million URLs. If you need every href on the domain, use a crawler built for that. If you need to know whether tech, on-page, compliance, and cluster coverage fail in the same pattern, the sample is the faster first pass.
Start the sampled site audit as soon as the file is live and valid. Do not wait for a week of “let Google digest it.”
Why stratified, not first-N
First-N lines of sitemap.xml are usually the homepage, a few product templates, and whatever the CMS wrote first. That is not the site. Stratify by path prefix inside a locale: docs vs blog vs pricing, or product vs help vs legal. Language subdirectory is not a column. A generate sitemap sample that treats /en/ as a theme will report that the site is “about English.”
Fifty pages is enough for a 200-URL brochure site. Five hundred is the usual ceiling; more pages after that repeat the same template defects.
Four reports from one draw
The same draw becomes four reports:
| Report | Question | Typical miss after a fresh file |
|---|---|---|
| Tech | Can a crawler fetch the URL? | Redirect chains, blocked assets |
| On-page | Does the page state a topic? | Missing H1, thin title |
| Compliance | Should this URL be in the map? | noindex listed, junk paths |
| Topic cluster | Which columns are fat or empty? | Locale mistaken for a theme |
Compliance is the report generator tutorials skip. You just rebuilt the file. The CMS still listed 12,000 filters. That is a generate sitemap defect, not a title-tag defect. Crawl-budget cleanup after the sample is sitemap SEO optimization, not a ranking ritual.
Tool landscape
Generators write XML. Validators check syntax. Desktop crawlers walk links. Sampled auditors parse the map and score a draw.
| Job | Typical tool | What SEO Health does |
|---|---|---|
| Write XML | CMS plugin, script | We do not replace your generator |
| Validate syntax | Search Console, XML linter | We fail a file that will not parse |
| Full link crawl | Desktop crawler | Out of scope; we sample |
| Sampled site audit | SEO Health | Parse → 50–500 draw → four reports |
A generate sitemap module inside a suite is often only the first row. Useful. Not an audit. Search Console is where you submit the file and watch processing errors. It will not tell you that lastmod is lying or that /en/ was treated as a topic.
Implementation steps
- Confirm the sitemap URL in robots.txt.
- Build from the live canonical set — plugin, script, or index.
- Exclude junk before the first submit.
- Validate well-formed XML and the size cap.
- Spot-check twenty URLs for 200.
- Parse. Stratify. Draw 50–500 pages. Do not take the first N lines.
- Read tech, on-page, compliance, and cluster reports.
- Fix the weakest cluster. Rebuild once. Re-sample the same buckets.
If you generate sitemap files on a timer that rewrites lastmod on every unchanged row, stop the timer. lastmod is a change log, not a recrawl lever. Cadence and split rules sit in Sitemap Best Practices.
After you clean the generated file, re-run the sampled site audit so the four reports read the new inventory.
Failure modes
These are inventory failures, not scoring-theater failures.
- Bloated map. A generate sitemap export that includes filters, expired landers, print views, and staging hosts looks complete. Crawl budget goes to junk. The sample then looks like the junk. Fix the inventory before you argue about titles.
- lastmod abuse. Nightly rebuilds that stamp today on 80,000 unchanged posts train crawlers to ignore your dates. Bumping lastmod to “force a recrawl” is the same failure in a hurry. Change the page, then record a true date.
- Sampling bias. Drawing the first 200 lines, the nav, or one folder and calling it the site misses help docs, legal, or a locale that is quietly broken. After you generate sitemap XML, a sample that is not stratified reports the loudest directory as the strategy.
None of these are “the checker was unreliable.” They are file and sampling failures. Fix the list, then the pages.
Frequently Asked Questions
Does generating the file raise rankings?
Bottom line: No. Discovery is not a ranking bonus. Crawlers may find URLs faster. Eligibility, quality, and links still decide what ranks. A clean generate sitemap file never substitutes for a page that does not deserve to rank.
How often should I rebuild the file?
Bottom line: generate sitemap: When URLs are created, removed, or canonicalized. Not on a clock that rewrites lastmod. Rebuild after a migration or a locale launch. Then validate and sample. Do not rebuild as a substitute for fixing titles.
Where do I declare the file location?
Bottom line: Put the absolute address in robots.txt. Submit the same address in Search Console if you use it. Common paths are /sitemap.xml and /sitemap_index.xml.
Do I need a million-page crawl after I build the file?
Bottom line: Not first. Parse the map. Draw 50–500 pages across real columns. A full crawl is a later luxury. SEO Health will not pretend to be that crawler.
What if the CMS lists junk URLs?
Bottom line: Exclude them in the plugin, or replace the plugin with a script that reads the canonical set. Then generate sitemap output again once. Sampling a junk file only proves the junk.
Conclusion
A generate sitemap job is inventory work plus an honest sample. Publish a clean XML list from live canonical URLs. Validate markup, size, and status. Do not treat lastmod as a lever. Do not treat /en/ as a topic. Then run the sampled site audit, read four reports, and fix the weakest cluster before you rebuild. For the method around the file, stay on Sitemap for SEO.
About the author — SEO Health Team. Reviewer: William Zhu (GitHub). Published and updated 2026-08-16. Credentials appear only here.