← Writing

Astro's sitemap integration stamps lastmod on every URL with one config line

Passing lastmod: new Date() to @astrojs/sitemap dates every URL at build time — a free content-freshness signal for a static site that rebuilds on every push.

Content-freshness signals matter to search engines and to the AI-crawler audit tools everyone runs now. For a static site there’s a one-line version:

// astro.config.mjs
sitemap({
  lastmod: new Date(),
})

Every URL in the generated sitemap gets a <lastmod> of the build time. Since the site rebuilds on every push, the date is honest by construction — “last modified” for a fully static site is the last deploy.

Pair it with on-page signals, because some scanners never read the sitemap: a dateModified field in your JSON-LD and an og:updated_time meta tag, both stamped with the same build time. One build timestamp, three freshness signals, zero maintenance.

← All writing Book a call →
Book a call → WhatsApp