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.
Why this matters
Generate canonical, indexable URLs from your content store, not from a crawl.
Before you start
- A content source with canonical URLs and updated timestamps
How to apply it
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.
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.
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 playbook · curated entry · report an error
Framework notes
nextjs-app
`app/sitemap.ts` maps your data to `{ url, lastModified, changeFrequency, priority }`; use `generateSitemaps()` for large sets.
astro
Use the `@astrojs/sitemap` integration with `site` set in `astro.config.mjs`; it paginates large sites automatically.
shopify
Shopify generates `/sitemap.xml` with locale and type children; extend it with custom entries only if you add non-Shopify content.