scalpel@labs: ~/glossary/xml-sitemap.mdx5 sections

XML Sitemap

An XML sitemap is a urlset file listing URLs you want search engines to find. One loc element per URL. Aids discovery on large sites with weak internal links. Does not make a page rank.

extension: Scalpel Linksupdated: 2026-08-14read_time: 2 min
less xml-sitemap.mdx

Why it matters

Crawlers find most pages by following links. A sitemap is a shortcut: "here are URLs I want you to know about." Useful for new sites (no crawlers yet), big sites (too many links to crawl all of them), or sites with dead zones (an archive template with no cross-links).

Submitting a sitemap does not force indexing. Crawlers still respect robots.txt, noindex tags, and whether the page actually exists. A listing is a suggestion, not a guarantee. But for large sites with weak internal links, a sitemap helps the crawler find what it might otherwise miss.

How it works

An XML sitemap is a file listing URLs you want search engines to discover. The format is strict XML with one <url> entry per page. Each entry has a required <loc> element (the actual URL) and optional metadata like <lastmod>, <changefreq>, and <priority>.

<?xml version="1.0" encoding="UTF-8"?>
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
  <url>
    <loc>https://example.com/page1</loc>
    <lastmod>2025-01-15</lastmod>
  </url>
  <url>
    <loc>https://example.com/page2</loc>
  </url>
</urlset>

Google ignores the priority element; it reads the page's actual importance from links and content. The lastmod date only helps if you keep it current. If it's stale, Google learns to ignore it.

For large sites, you split a sitemap into a sitemap index, which lists multiple sitemaps. Each file can hold up to 50,000 URLs and stay under 50 MB uncompressed.

What does not matter

A sitemap does not make a page rank. It does not improve SEO directly. It simply helps discovery. A well-linked site with good internal structure doesn't need one. A brand-new site with no incoming links benefits more.

The file format also matters less than you might think. Google accepts sitemaps in XML, RSS, plain text (one URL per line), and as a Sitemap index. Pick whatever your site already generates. If you have a static site generator or CMS, it probably exports XML already.

Also, you don't need to update a sitemap on every page change. Crawlers check it periodically. For large publishing sites that update hourly, the overhead of regenerating a sitemap every time outweighs the benefit.

Code example

<!-- Complete XML sitemap example -->
<?xml version="1.0" encoding="UTF-8"?>
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
  <!-- Homepage -->
  <url>
    <loc>https://example.com/</loc>
    <lastmod>2025-01-20</lastmod>
    <changefreq>daily</changefreq>
  </url>
  
  <!-- Blog post -->
  <url>
    <loc>https://example.com/blog/how-to-use-sitemaps</loc>
    <lastmod>2025-01-15</lastmod>
    <changefreq>monthly</changefreq>
  </url>
  
  <!-- Product page -->
  <url>
    <loc>https://example.com/products/widget-pro</loc>
    <lastmod>2024-12-01</lastmod>
    <changefreq>weekly</changefreq>
  </url>
</urlset>

To publish it, place the file at https://example.com/sitemap.xml and either submit it directly to Google Search Console or reference it in your robots.txt:

Sitemap: https://example.com/sitemap.xml

In Scalpel Links, click the export button and select "Export as XML sitemap". It writes your matched links as a valid urlset file, ready to download and place on your server. All links get the current date as <lastmod>. If you've filtered the page, only those links appear in the sitemap.

Sources