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.

highIn codeimpact effort

Why this matters

Generate canonical, indexable URLs from your content store, not from a crawl.

Get the full breakdown

The extended brief explains when this works, when it does not, and the trade-offs. Join the waitlist and it unlocks for every tip when sign-in opens; MCP access is the paid part.

Join the waitlist

Before you start

  • A content source with canonical URLs and updated timestamps

How to apply it

  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.

Get the prompt for your agent

A ready-to-paste prompt for your agent that implements this tip and verifies the result in your repo.

Join the waitlist

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.

Official references

Let your agent apply this + 161 more tips.

Pre-order — $19