Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

To generate an XML sitemap, export the canonical, indexable URLs on your site into UTF-8 XML, publish it at a stable URL such as /sitemap.xml, and submit that URL in Google Search Console or your robots.txt. A sitemap helps search engines discover URLs; it is only a hint and does not guarantee crawling or indexing.

For a small site, a text file is enough. For a CMS or a large database-backed site, generate the file automatically from the system that knows which URLs are canonical. A crawler can find URLs, but it should not be your only source of truth because navigation may expose redirects, duplicates, parameter URLs and pages that should not be indexed.

What an XML sitemap scraper actually does

In this context, a “sitemap scraper” is software that collects eligible URLs and writes them in the XML Sitemap protocol. It may read a CMS database, application routes, a URL inventory, or a crawl of your site. The output tells search engines about pages, images, videos or news items and the relationships between sitemap files.

Discovery is the main benefit. Search engines still decide whether to fetch, crawl and index each URL. A sitemap cannot override a noindex, canonical choice, access restriction or poor-quality page.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Pick the URL source first

  • CMS-generated: WordPress, Wix, Blogger and similar platforms commonly create a sitemap automatically. Find the platform’s sitemap setting and public URL before installing another generator.
  • Database or application export: Best for a large site. Export the URLs your routing and publishing rules mark as canonical and indexable.
  • Crawl: Useful for auditing an unfamiliar site or finding orphaned pages, but filter the crawl results against canonical, redirect and indexing rules.
  • Manual file: Practical for fewer than a few dozen stable URLs.

XML sitemap format and hard limits

Use UTF-8 XML, absolute URLs and the urlset namespace. A minimal file looks like this:

<?xml version="1.0" encoding="UTF-8"?>
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
  <url>
    <loc>https://example.com/</loc>
    <lastmod>2026-09-20</lastmod>
  </url>
  <url>
    <loc>https://example.com/docs/getting-started</loc>
  </url>
</urlset>

Google’s current guidance allows at most 50,000 URLs or 50 MB uncompressed per sitemap. When either limit is reached, split the files and publish an index:

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

URL order does not matter. Escape XML characters in every value: for example, write &amp; for an ampersand. Include only URLs on the intended site that you want considered for search.

Should you include lastmod?

Include lastmod only when your system records it consistently and it represents a meaningful page update. Do not change it merely because a copyright year or template changed. Google ignores priority and changefreq, so omitting them avoids maintaining fields that do not help.

What’s actually slowing this PC down?

Pick the symptom - the matching free tool is one click away.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Generate a sitemap from a URL inventory

This Python example takes a newline-delimited list of canonical URLs, removes duplicates, escapes XML safely, and writes files of no more than 50,000 URLs. It deliberately does not pretend that a crawl can determine canonical status by itself: supply an already-approved inventory or add your own application checks.

from pathlib import Path
from urllib.parse import urlparse
from xml.sax.saxutils import escape

MAX_URLS = 50_000
BASE = "https://example.com"

raw = Path("canonical-urls.txt").read_text(encoding="utf-8").splitlines()
urls = []
seen = set()
for line in raw:
    url = line.strip()
    if not url or url in seen:
        continue
    parsed = urlparse(url)
    if parsed.scheme not in {"http", "https"} or parsed.netloc != urlparse(BASE).netloc:
        continue
    seen.add(url)
    urls.append(url)

out = Path("public/sitemaps")
out.mkdir(parents=True, exist_ok=True)
files = []
for start in range(0, len(urls), MAX_URLS):
    chunk = urls[start:start + MAX_URLS]
    name = f"pages-{start // MAX_URLS + 1:03d}.xml"
    body = ['<?xml version="1.0" encoding="UTF-8"?>',
            '<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">']
    body += [f"  <url><loc>{escape(url)}</loc></url>" for url in chunk]
    body.append("</urlset>")
    (out / name).write_text("n".join(body) + "n", encoding="utf-8")
    files.append(f"{BASE}/sitemaps/{name}")

index = ['<?xml version="1.0" encoding="UTF-8"?>',
         '<sitemapindex xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">']
index += [f"  <sitemap><loc>{escape(url)}</loc></sitemap>" for url in files]
index.append("</sitemapindex>")
(out / "index.xml").write_text("n".join(index) + "n", encoding="utf-8")

Replace BASE and the inventory path, then deploy public/sitemaps/index.xml and the referenced files. If your site has fewer than 50,000 URLs, you can publish one sitemap.xml instead of an index.

Build a crawler-backed generator safely

If you must discover URLs by crawling, start from approved internal entry points and enforce these checks before writing an entry:

  • Keep only the intended hostname and accepted URL schemes.
  • Normalize URLs consistently, while preserving meaningful query parameters.
  • Drop redirects, error responses, duplicate content and URLs whose page declares another canonical URL.
  • Exclude pages marked noindex, private areas, search-result pages, tracking parameters and infinite calendar or faceted-navigation combinations unless they are deliberately indexable.
  • Respect robots.txt and applicable rate limits; do not use the sitemap as a way around access controls.
  • Record the final canonical URL and, when available, a verified modification timestamp.

For very large inventories, generate shards incrementally from the database rather than loading every URL into memory. Keep a deterministic naming scheme, write a new generation to a temporary directory, validate it, and then atomically switch the public index. This prevents a partial deployment from leaving search engines with missing shards.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Rank #3
Google's PageRank and Beyond: The Science of Search Engine Rankings
  • New
  • Mint Condition
  • Dispatch same day for order received before 12 noon
  • Guaranteed packaging
  • No quibbles returns

Publish, test and submit the file

  1. Place the file at a stable public URL, preferably near the site root, such as https://example.com/sitemap.xml. An index can point to files in a dedicated directory.
  2. Request the URL and check the HTTP status, content type and body. It must return complete XML, not an HTML error page or a login redirect. Compression is fine when your server advertises it correctly.
  3. Validate well-formed XML, absolute loc values, duplicate removal, sitemap-size limits and the HTTP response of representative listed URLs.
  4. Submit the sitemap or sitemap index in Google Search Console. You can also add this line to robots.txt: Sitemap: https://example.com/sitemap.xml.
  5. Monitor the Search Console Sitemaps report for fetch, parsing and processing errors. Correct the generator or deployment, then resubmit.

Submitting is a hint: Google may choose not to download the file or crawl every URL in it.

When a sitemap is worth maintaining

Sitemaps are especially useful for large sites, new sites with few external links, and sites with important video, image or news content. A site of roughly 500 pages or fewer may not need one when every page is comprehensively linked and there is little specialized media. That is a usefulness guideline, not an indexing guarantee or a quota.

Common failures and fixes

“Couldn’t fetch” or an HTTP error

Check DNS, TLS, authentication, firewall rules and redirects. Fetch the exact submitted URL from outside your network and ensure it returns the XML file with a successful status.

XML parsing error

Inspect the first line, namespace, unescaped ampersands, illegal control characters and missing closing tags. Generate XML with an XML library rather than string concatenation where possible.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

URLs are rejected or not indexed

Compare each URL with its final redirect target, rel="canonical", robots directives and HTTP status. Remove noncanonical, redirected, blocked or noindex URLs. A valid sitemap cannot make an ineligible page indexable.

Only some shards process

Verify every index URL is absolute, publicly reachable and below the per-file limits. Check for a deployment that published the index before all shards were uploaded.

lastmod warnings

Use a database timestamp tied to substantive content changes. If your timestamp is unreliable, omit lastmod instead of reporting false freshness.

Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Or skip the browser setup

ScreenshotNeo is a website screenshot API, not an XML sitemap generator, but it can capture a rendered page when you need visual checks of templates or documentation pages in an automated pipeline. It accepts cookie banners before capture and removes more than 60 known consent platforms, newsletter popups and chat widgets; each cleanup step can be disabled. Bot checks or CAPTCHAs, blank pages, timeouts, failed loads and cache hits are not billed, and responses identify the result with X-Page-Verdict and X-Billed headers. Its MCP server provides take_screenshot, get_page_info and capture_pdf tools for Claude, Cursor and other MCP clients.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

One request returns PNG, JPEG, WebP or PDF:

curl -G "https://api.screenshotneo.com/v1/shot" -d access_key=YOUR_API_KEY --data-urlencode url=https://example.com -o shot.webp

See the ScreenshotNeo API documentation for all options. The same request in Python:

import requests
r = requests.get("https://api.screenshotneo.com/v1/shot", params={"access_key": "YOUR_API_KEY", "url": "https://example.com"}, timeout=90)
open("shot.webp", "wb").write(r.content)

Node.js:

const q = new URLSearchParams({ access_key: 'YOUR_API_KEY', url: 'https://example.com' });
const res = await fetch(`https://api.screenshotneo.com/v1/shot?${q}`);
const body = Buffer.from(await res.arrayBuffer());

Features include full-page and CSS-selector captures, lazy-image loading, device presets, retina scale, dark mode, custom CSS and JavaScript, clicks, waits, request blocking, headers, cookies, user agents, geolocation, transparent backgrounds, resizing, TTL caching, signed links, asynchronous webhooks, bulk capture of 100 URLs per call, usage reporting and an OpenAPI specification. One thousand screenshots per month are free with no card; paid plans start at $5 for 3,000. Create a free ScreenshotNeo account.

Operational checklist

  • Generate from canonical, indexable URLs.
  • Use absolute, escaped URLs and UTF-8 XML.
  • Stay below 50,000 URLs and 50 MB uncompressed per file.
  • Use an index for multiple files.
  • Publish atomically and test HTTP responses.
  • Submit in Search Console or robots.txt, then monitor processing.

Frequently Asked Questions

Can I submit multiple sitemap files without an index?

Yes. You can submit individual sitemap URLs in Search Console, while a sitemap index is usually easier to maintain for a changing set of shards.

Does a sitemap replace internal links?

No. Maintain crawlable internal links; the sitemap is an additional discovery signal.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Can I include URLs from another domain?

Normally no. Keep sitemap URLs within the site and sitemap location scope you control.

Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.