Sitemap lastmod: how Google uses it, and how to stop sending dates it ignores
Google uses lastmod to decide what to recrawl, and stops trusting it when every URL claims it changed today. How to spot a bad lastmod and generate it from real content changes in Next.js, WordPress and Laravel.

Google uses the sitemap lastmod value as a signal for scheduling recrawls, but only if it's "consistently and verifiably" accurate, which Google checks by comparing it with the page's real last modification (Google's sitemap docs, checked 2 November 2026). The value should be the time of the last significant change to the page: main content, structured data or links. The most common mistake is stamping every URL with the time the sitemap was built or requested. That tells Google 50,000 pages changed today, and Google learns to ignore the field. Use the time each page's content last changed, or leave lastmod out for pages where you can't know it.
What Google says about lastmod
The definition, from the build and submit a sitemap page:
"The
<lastmod>value should reflect the date and time of the last significant update to the page. For example, an update to the main content, the structured data, or links on the page is generally considered significant, however an update to the copyright date is not."
Google's 2023 post that retired the sitemaps ping endpoint spelled out how the field is used: "lastmod is indeed useful in many cases and we're using it as a signal for scheduling crawls" (Search Central blog). It also said what happens when the dates are wrong: "if your page changed 7 years ago, but you're telling us in the lastmod element that it changed yesterday, eventually we're not going to believe you anymore."
The same post makes three practical points:
- A change to the sidebar or footer doesn't need a new
lastmod. A change to "the primary text", structured data or links does. - You don't have to put
lastmodon every URL. Leaving it out for pages where the date is unclear, such as category pages, is fine. - Google "still doesn't use the
changefreqorpriorityelements at all." The build-and-submit page repeats this: "Google ignores<priority>and<changefreq>values."
So lastmod is the one optional field in a URL entry that Google reads. It isn't a ranking factor and it doesn't force a crawl. It helps Google pick which known URLs to fetch again, and that helps most on large sites.
The format
The sitemaps protocol requires W3C Datetime. Google's Sitemaps report help gives two valid examples: 2005-02-21 and 2005-02-21T18:00:15+00:00. Date-only works; a full timestamp with a timezone is better when you have it.
<url>
<loc>https://example.com/jobs/senior-backend-engineer-dubai</loc>
<lastmod>2026-10-28T09:14:00+04:00</lastmod>
</url>
Anything else is an "Invalid date" error in the Sitemaps report. You can catch it before Google does by validating against the protocol's schema with xmllint:
curl -sS -o sitemap.xsd https://www.sitemaps.org/schemas/sitemap/0.9/sitemap.xsd
curl -sS -o sitemap.xml https://example.com/sitemap.xml
xmllint --noout --schema sitemap.xsd sitemap.xml
A day-first date fails like this:
sitemap.xml:2: element lastmod: Schemas validity error : Element '{http://www.sitemaps.org/schemas/sitemap/0.9}lastmod': '30/10/2026' is not a valid value of the union type '{http://www.sitemaps.org/schemas/sitemap/0.9}tLastmod'.
sitemap.xml fails to validate
A valid file prints sitemap.xml validates.
How to tell if your lastmod is useless
Count how many URLs share each date:
curl -sS https://example.com/sitemap.xml \
| grep -o '<lastmod>[^<]*' | cut -c10- | cut -c1-13 \
| sort | uniq -c | sort -rn | head
The cut -c1-13 groups by date and hour. A healthy content site shows a long tail: a few URLs changed this hour, more last week, most months ago. A broken one looks like this:
48211 2026-11-02T06
Every URL, same hour. Then fetch the sitemap again a few minutes later. If the time moved, the sitemap is stamping the request time, not the content's.
Spot-check the other direction too: pick five pages you know changed recently and five you haven't touched in a year, and compare what the sitemap claims. If an edited article still shows its publish date, your generator reads the wrong column.
Where bad lastmod values come from
The build or request time
The Next.js docs' own sitemap.ts example sets lastModified: new Date() on every entry (Next.js sitemap docs). It's meant to show the shape of the object, but it gets copied into production as is. On a statically built site, every URL gets the deploy time. On a dynamic one, every URL gets the time of the request. Static site generators and sitemap plugins that fall back to "now" when a page has no date do the same.
An updated_at column that changes for the wrong reasons
Using the database's updated_at is better than "now", but it moves for reasons that have nothing to do with the page: a view counter, a recalculated score, a nightly import that rewrites every row, a status sync from another system. If a cron job touches all 40,000 rows at 03:00, your sitemap claims 40,000 changes at 03:00.
WordPress's modified date
WordPress core sitemaps (since 5.5, at /wp-sitemap.xml) set each post's lastmod from post_modified_gmt (WordPress source). That date moves whenever the post is saved, whether you rewrote it or fixed a typo. It's close to right for most blogs. It's wrong when a bulk edit, a plugin migration or a search-and-replace saves every post at once.
Template-wide changes
Changing the footer, the navigation or the copyright year on every page is not a significant change in Google's terms. If your lastmod comes from "when was this HTML last different", a site-wide template edit resets the date on every URL. Hash the content you care about, not the rendered page.
Generating lastmod from real content changes
The fix is the same on every stack: store a separate timestamp that only moves when the fields Google cares about change, and put that timestamp in the sitemap.
Laravel
Keep a content_changed_at column and set it in a model event only when significant fields are dirty:
// app/Models/Job.php
protected $casts = ['content_changed_at' => 'datetime'];
protected static function booted(): void
{
static::saving(function (Job $job) {
$significant = ['title', 'description', 'salary_min', 'salary_max', 'location', 'status'];
if (! $job->exists || $job->isDirty($significant)) {
$job->content_changed_at = now();
}
});
}
A view counter increment or a score recalculation no longer touches it. Then write the sitemap from that column. With spatie/laravel-sitemap (GitHub), setLastModificationDate() sets the value per URL:
use Spatie\Sitemap\Sitemap;
use Spatie\Sitemap\Tags\Url;
$sitemap = Sitemap::create();
Job::query()
->where('status', 'open')
->select(['id', 'slug', 'content_changed_at'])
->lazyById()
->each(fn (Job $job) => $sitemap->add(
Url::create(route('jobs.show', $job))
->setLastModificationDate($job->content_changed_at)
));
$sitemap->writeToFile(public_path('sitemap-jobs.xml'));
For existing rows, backfill content_changed_at from the best date you have (the publish date, or updated_at if it's clean) rather than from today.
Next.js
Read the stored timestamp in app/sitemap.ts and leave lastModified out where you have nothing real:
// app/sitemap.ts
import type { MetadataRoute } from 'next'
import { db } from '@/lib/db'
export default async function sitemap(): Promise<MetadataRoute.Sitemap> {
const posts = await db.post.findMany({
where: { published: true },
select: { slug: true, contentUpdatedAt: true },
})
return [
// no date we can trust for the home page: omit it
{ url: 'https://example.com/' },
...posts.map((post) => ({
url: `https://example.com/blog/${post.slug}`,
lastModified: post.contentUpdatedAt,
})),
]
}
For pages that live in the repo rather than the database, the last commit that touched the file is a decent proxy:
git log -1 --format=%cI -- app/pricing/page.tsx
# 2026-09-14T11:02:37+04:00
Run that at build time and write the results to a JSON file sitemap.ts can import. Make sure your CI checkout has full history: in a shallow clone of depth 1, every file's last commit is the same one, which is the build-time bug again. The Next.js sitemap guide covers splitting and revalidation.
WordPress
To keep typo fixes from moving the date, record your own timestamp when the title or body changes, and feed it to the core sitemap through the wp_sitemaps_posts_entry filter:
// functions.php or a small plugin
add_action( 'post_updated', function ( $post_id, $after, $before ) {
if ( $after->post_content !== $before->post_content
|| $after->post_title !== $before->post_title ) {
update_post_meta( $post_id, '_content_changed_gmt', $after->post_modified_gmt );
}
}, 10, 3 );
add_filter( 'wp_sitemaps_posts_entry', function ( $entry, $post ) {
$changed = get_post_meta( $post->ID, '_content_changed_gmt', true );
if ( $changed ) {
$entry['lastmod'] = wp_date( DATE_W3C, strtotime( $changed ) );
}
return $entry;
}, 10, 2 );
Posts without the meta keep core's post_modified_gmt. If you use an SEO plugin's sitemap instead of core's, check its own filters; the idea is the same.
lastmod in a sitemap index
A sitemap index can carry lastmod per child sitemap, in the same W3C format (Google's sitemap index docs). Set it to the newest lastmod inside that child. A child that holds old, stable URLs then keeps an old date, and the child where new content lands shows today. Stamping every child with the generation time is the same mistake one level up.
What lastmod won't do
- It won't get a page crawled on demand. Submitting a sitemap is "merely a hint", in Google's words, with no guarantee Google downloads or uses it (build and submit a sitemap). For engines that support it, IndexNow is the push mechanism; see IndexNow in Next.js. Google doesn't take part.
- It won't fix pages Google decided not to index. A fresh date on a page stuck in "Crawled, currently not indexed" just invites another crawl of the same thin page. Our post on crawled, currently not indexed for programmatic pages covers that problem.
- Faking freshness backfires. Bumping dates to look fresh is exactly the pattern Google says makes it stop believing you.
How SEOFix checks it
Every SEOFix audit reads the lastmod values from your sitemap and raises SITEMAP_LASTMOD_UNRELIABLE when nearly every URL carries the same date, often the moment the sitemap was generated (site structure and sitemap checks). In the code, that means at least 20 dated entries, with 80% or more falling inside a single one-hour window or within 15 minutes of when SEOFix fetched the sitemap. The issue includes a sample of the repeated value, so you can see which generator wrote it. The same report flags sitemap URLs that redirect, error, carry noindex or canonicalise elsewhere, which are the other reasons search engines trust a sitemap less.
FAQ
Should I remove lastmod entirely? If you can't make it accurate, yes, for the URLs where you can't. Google's own post says leaving it out where the date is unclear is fine. A wrong value is what teaches Google to stop believing your dates.
Date only or full timestamp? Both are valid. Use a timestamp with a timezone if you publish or update more than once a day.
Does lastmod need to match the Last-Modified HTTP header? The sitemaps protocol says the tag "is separate from the If-Modified-Since (304) header the server can return, and search engines may use the information from both sources differently." Deriving both from the same content timestamp keeps them from contradicting each other.
Do changefreq and priority do anything? Not for Google. You can drop them.
See whether your sitemap dates are trustworthy, along with every sitemap URL that redirects or carries noindex: the first SEOFix audit is free (up to 500 pages).
Keep reading

React SEO for single-page apps: prerender, SSR, per-route meta tags and real 404s
A Vite or Create React App site sends the same empty shell for every URL. Prerendering with React Router, React 19's title and meta tags, and real 404 status codes fix most of it without a rewrite.
1,666 words · 8 min read

Duplicate without user-selected canonical: which page Google kept, and how to set canonicals by template
Google found two URLs with the same content, neither declared a canonical, so Google picked one. How to check its choice, find where the variants come from, and set canonicals in Next.js and WordPress.
1,762 words · 8 min read

Trailing slash SEO: pick one form, redirect the other, and make every layer agree
/about and /about/ are two URLs to Google. Neither form ranks better; what hurts is serving both, or having two layers that each redirect the other way. Framework defaults, server config and a curl test.
1,494 words · 7 min read