Problem
Both sitemaps set lastmod to the current timestamp instead of the actual last-modified date of each page:
// next-sitemap.config.js
lastmod: config.autoLastmod ? new Date().toISOString() : undefined
// src/pages/server-sitemap.xml/index.ts
url.lastmod = new Date().toISOString()
Why it matters
Per Google's sitemap documentation:
Google ignores <lastmod> if it's consistently inaccurate. When every URL always shows today's date, crawlers learn the value is unreliable and stop using it to prioritize recrawling — defeating the entire purpose of the field.
In practice this means:
- Pages with genuinely fresh content don't get prioritized for recrawling
- Crawl budget is not allocated based on actual content freshness
Expected behavior
lastmod should reflect when the content was last modified, not when the sitemap was generated:
- Static sitemap: use the git commit date or the article's frontmatter
updatedAt field (if available)
- Server-side sitemap: use the
lastmod from the OpenAPI spec file or navigation data if available; otherwise omit the field rather than emit a misleading timestamp
Omitting lastmod entirely is valid and preferable to an inaccurate value.
References
Files to change
Problem
Both sitemaps set
lastmodto the current timestamp instead of the actual last-modified date of each page:next-sitemap.config.js): every page gets the build timestamp, even pages untouched for months.src/pages/server-sitemap.xml/index.ts): every page gets the request timestamp, which changes on every crawl.Why it matters
Per Google's sitemap documentation:
In practice this means:
Expected behavior
lastmodshould reflect when the content was last modified, not when the sitemap was generated:updatedAtfield (if available)lastmodfrom the OpenAPI spec file or navigation data if available; otherwise omit the field rather than emit a misleading timestampOmitting
lastmodentirely is valid and preferable to an inaccurate value.References
Files to change
next-sitemap.config.js— static sitemaplastmodlogicsrc/pages/server-sitemap.xml/index.ts— server-side sitemaplastmodassignment