Skip to content

fix(sitemap): lastmod timestamps are always "now", misleading Google recrawl prioritization #1275

@PedroAntunesCosta

Description

@PedroAntunesCosta

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions