---
title: "Add sitemap.xml with accurate lastmod"
description: "An XML sitemap lists canonical, indexable URLs so crawlers discover them without following every link. Build it from the content store, use absolute URLs that match the page canonical, and set lastmod only when content meaningfully changed. Split large sites into child sitemaps under an index."
url: "https://seo-mcp.io/t/add-sitemap-xml-with-accurate-lastmod"
---

# Add sitemap.xml with accurate lastmod

An XML sitemap lists canonical, indexable URLs so crawlers discover them without following every link. Build it from the content store, use absolute URLs that match the page canonical, and set lastmod only when content meaningfully changed. Split large sites into child sitemaps under an index.

## Prerequisites

- A content source with canonical URLs and updated timestamps

## Steps

1. **Generate from canonical content records** — Emit one entry per published, indexable URL. Exclude drafts, noindexed pages, redirects, tag archives and parameter variants. Use absolute HTTPS URLs.
   Check: Every loc in the sitemap returns 200 and no loc appears twice.
2. **Set lastmod honestly** — Write the timestamp of the last content change, not the deploy time. Bulk template changes should not touch every lastmod value.
   Check: Sample ten URLs: each lastmod matches the visible last-updated date within one day.
3. **Split and reference the file** — Create a sitemap index when any child would exceed 50,000 URLs or 50 MB. Add the index URL to robots.txt and submit it in Search Console.
   Check: The sitemap index returns 200, lists every child, and appears in the Search Console Sitemaps report.

## Source

@seo-mcp on 2026-10-19: https://developers.google.com/search/docs/crawling-indexing/sitemaps/build-sitemap

Canonical: https://seo-mcp.io/t/add-sitemap-xml-with-accurate-lastmod
