In short
The <lastmod> tag gives, for each URL in a sitemap, the date of the page's last significant change. Google uses it if it is consistently and verifiably accurate; Bing uses it to decide what to recrawl. Once the check is done, the date changes when the main text, structured data or links change, and only then, in W3C Datetime format, preferably with the time and time zone.
Why it matters
A search engine cannot recrawl everything every day. To choose, it relies on what it knows about each page, and the sitemap gives it a shortcut: “this URL changed on 18 November”. If the information is accurate, the search engine revisits the modified pages rather than the unchanged ones.
Both search engines have been explicit:
- Google ignores
<priority>and<changefreq>, but uses<lastmod>when it matches reality. It stops trusting it when the dates do not match the changes it observes. A change to the sidebar, the footer or the copyright year is not significant; a change to the main content, structured data or links is. - Bing asks for a date reflecting the real last modification of the content, not the time the sitemap was generated, in ISO 8601 format with date and time. It generally rereads submitted sitemaps at least once a day and explicitly links this freshness to how quickly updates appear in its AI-generated answers.
The most common failure scenario is the sitemap that shows today's date for every URL, because the generator writes the time the file was produced. The signal turns into noise and the search engine discards it, including on the day you publish a genuinely important update.
What it improves
- Recrawling Pages that really changed are revisited sooner. The effect is mostly visible on sites that change often (catalogs, news, documentation).
- Freshness in search results and AI answers A corrected price, product page or procedure is more likely to be picked up quickly. No guarantee of timing or citation.
- Server load Fewer pointless recrawls of unchanged pages.
- Rankings No direct effect. A recent date does not make a page more relevant, and an artificially inflated date falls under practices to avoid (opens in a new tab).
How to check
Date distribution. Count the most frequent dates in the sitemap:
curl -s https://example.com/sitemap.xml | grep -o '<lastmod>[^<]*' | cut -c10-19 | sort | uniq -c | sort -rn | head
For an index, run the command on a child sitemap. A healthy result shows dates spread over time. A warning sign: almost every URL on the same date, especially today's.
Format. Accepted values follow the W3C Datetime format: 2026-11-18 or 2026-11-18T14:05:00+01:00. If the time is present, the time zone (+01:00 or Z) is required. Search Console flags invalid dates in the Sitemaps report.
Accuracy. Pick ten pages at random and compare the sitemap date with the modification date visible on the page, the dateModified property in the structured data and the CMS history. All four must tell the same story. Then fix a typo in the footer: if every date on the site moves, the generator does not tell significant changes apart.
How to implement
Before you start
First define what counts as a significant change for your site, then store that date separately from the technical save date:
| Change | Update lastmod? |
|---|---|
| Main text rewritten, section added, answer corrected | Yes |
| Price, availability, product specifications | Yes |
| Structured data modified | Yes |
| Links added or removed in the content | Yes |
| Typo fixed, formatting | No, unless the meaning changes |
| Sidebar, footer, menu, copyright year | No |
| Cache regeneration, technical migration, bulk search-and-replace | No |
Three rules complete this table:
- A single source of truth. The same date feeds
<lastmod>, the displayed “Updated on” date anddateModifiedin JSON-LD. See Display the actual modification date (opens in a new tab). - No date rather than a wrong date. Google accepts that you omit
<lastmod>for pages whose date you do not know, such as the home page or some categories. - The index too. In a sitemap index, the
<lastmod>of each child file must be the most recent date among the URLs it contains, not the generation time.
Recommended format, which satisfies both Google and Bing:
<url>
<loc>https://example.com/guides/choisir-chaudiere/</loc>
<lastmod>2026-11-18T14:05:00+01:00</lastmod>
</url>
WordPress
Versions WordPress 6.5 to 7.1; Yoast SEO 20 to 28; Rank Math 1.0.
The native sitemap (/wp-sitemap.xml, with lastmod since WordPress 6.5), Yoast SEO and Rank Math fill in lastmod from the post's modification date (post_modified_gmt). This is correct in most cases, with two limits:
- Every save counts. Fixing a comma or reopening a page builder changes the date. For a simple fix, that is acceptable; for a bulk operation (database search-and-replace, import, page builder switch), do it in SQL or with WP-CLI without touching
post_modified, or accept that the dates will be skewed once. - Archives (home page, categories) take the date of the most recent post they contain. That is a reasonable approximation. The native sitemap, however, only dates posts and the home page when it shows the latest posts: categories and authors have no
lastmodthere.
If you manage a separate editorial update date (for example a _date_maj_editoriale custom field in Y-m-d H:i:s format, in UTC), plug it into the native sitemap:
add_filter('wp_sitemaps_posts_entry', function (array $entry, WP_Post $post): array {
$editorialDate = get_post_meta($post->ID, '_date_maj_editoriale', true);
if (! $editorialDate) {
return $entry;
}
$entry['lastmod'] = gmdate(DATE_W3C, strtotime("{$editorialDate} UTC"));
return $entry;
}, 10, 2);
With Yoast SEO, the wpseo_sitemap_entry filter allows the same replacement; see Yoast's developer documentation for its exact structure.
Shopify
Versions Shopify, all plans, November 2026.
Shopify generates its sitemaps on its own, dates included: there is nothing to configure. Just avoid pointless bulk edits to product pages (scripts or apps that rewrite every description), which move the dates without any real change.
Laravel
Versions Laravel 11 to 13; spatie/laravel-sitemap 7.3 and 8.x.
Do not use updated_at as is: Eloquent updates it on every save, including for a view counter. Add a dedicated column:
// database/migrations/2026_11_25_000000_add_content_updated_at_to_posts_table.php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
public function up(): void
{
Schema::table('posts', function (Blueprint $table) {
$table->timestamp('content_updated_at')->nullable()->after('updated_at');
});
}
public function down(): void
{
Schema::table('posts', function (Blueprint $table) {
$table->dropColumn('content_updated_at');
});
}
};
Then, in the App\Models\Post model (which implements Spatie\Sitemap\Contracts\Sitemapable and imports Spatie\Sitemap\Tags\Url), only date significant changes:
protected static function booted(): void
{
static::saving(function (Post $post) {
if (! $post->isDirty(['title', 'body', 'faq', 'price', 'schema'])) {
return;
}
$post->content_updated_at = now();
});
}
public function toSitemapTag(): Url
{
return Url::create(route('posts.show', $this))
->setLastModificationDate($this->content_updated_at ?? $this->published_at);
}
With spatie/laravel-sitemap, setLastModificationDate() writes the date in the expected format, time zone included. Initialize the column once with published_at for existing content.
Next.js
Versions Next.js 15 and 16 (App Router).
In app/sitemap.ts, the lastModified property must come from the CMS or the database, never from new Date(), which would give every URL the generation date:
import type { MetadataRoute } from 'next'
import { getArticles } from '@/lib/cms'
export default async function sitemap(): Promise<MetadataRoute.Sitemap> {
const articles = await getArticles()
return articles.map((article) => ({
url: `https://example.com/blog/${article.slug}`,
lastModified: article.contentUpdatedAt ?? article.publishedAt,
}))
}
With a headless CMS, check which field it exposes: the technical update date often changes for non-editorial reasons (translation, reordering). Prefer an editorial field filled in by writers.
Astro
Versions Astro 5 to 7; @astrojs/sitemap 3.x integration.
The lastmod option of the @astrojs/sitemap integration applies the same date to the whole site: do not use it. Use serialize() to date each page, here from the updatedDate front matter field:
// astro.config.mjs
import { defineConfig } from 'astro/config';
import sitemap from '@astrojs/sitemap';
import { readFileSync, readdirSync } from 'node:fs';
const dates = Object.fromEntries(
readdirSync('./src/content/blog')
.filter((file) => file.endsWith('.md'))
.map((file) => {
const source = readFileSync(`./src/content/blog/${file}`, 'utf8');
const match = source.match(/^updatedDate:\s*["']?([\d-]+)/m);
return [`/blog/${file.replace(/\.md$/, '')}/`, match?.[1]];
})
.filter(([, date]) => date),
);
export default defineConfig({
site: 'https://example.com',
integrations: [
sitemap({
serialize(item) {
const date = dates[new URL(item.url).pathname];
if (date) {
item.lastmod = new Date(date).toISOString();
}
return item;
},
}),
],
});
Static sites and generators
Without a database, the date of the last Git commit that touched the source file is a good approximation:
git log -1 --format=%cI -- content/guides/choisir-chaudiere.md
It returns a date in ISO 8601 format with a time zone. Two precautions: in continuous integration, fetch the full history (git fetch --unshallow or unlimited clone depth), otherwise every date is that of the last commit; and group purely cosmetic commits so as not to skew the dates.
Database
For a home-made generator, compute the date in the query, falling back to the publication date:
SELECT slug,
COALESCE(content_updated_at, published_at) AS lastmod
FROM articles
WHERE status = 'published'
ORDER BY lastmod DESC;
The index <lastmod> for this sitemap is the first row of the result.
Common mistakes
- Writing the sitemap generation time for every URL: the most widespread mistake, and the surest way to get the tag ignored.
- Making dates move on every deployment because the site is rebuilt entirely: the date of the generated file is not the date of the content.
- Using an ORM's
updated_at, which changes with the slightest technical save. - Refreshing dates without changing anything to look up to date: Google stops trusting the tag, and it is a misleading practice.
- Giving a time without a time zone (
2026-11-18T14:05:00): the W3C format requires one as soon as the time is present. - Showing a different date on the page: the sitemap says the 18th, the page says “updated on the 2nd” and the JSON-LD says the 10th. A single source of truth.
- Relying on
<changefreq>or<priority>: Google and Bing ignore them.
Frequently asked questions
Does Google still use the lastmod tag?
Yes, Google uses a sitemap's lastmod tag when it is consistently and verifiably accurate, that is, when the dates match the changes it observes when crawling the pages. If it spots far-fetched dates, it stops trusting them for the site. The changefreq and priority tags, on the other hand, are ignored. Bing also uses lastmod to choose the pages to recrawl.
Should lastmod change for a small fix?
No, a corrected typo or a footer tweak does not justify changing the lastmod date. Google talks about the last significant change: main content, structured data or links. If the fix changes the meaning of a piece of information, such as a price, a date or a step in a procedure, it becomes significant and the date must follow, on the page as well as in the sitemap.
Which date format should lastmod use?
Use the W3C Datetime format, derived from ISO 8601: a date alone such as 2026-11-18, or a date with time and time zone such as 2026-11-18T14:05:00+01:00. Bing recommends the more precise version with date and time. As soon as the time is included, the time zone, in the form +01:00 or Z, is required. Search Console flags invalid dates in the Sitemaps report.
Is an approximate date better than no date at all?
No date at all is better than a wrong date. Google accepts that you omit lastmod for pages whose real modification date your software does not know, such as the home page or some categories. A consistently wrong date, by contrast, can make the search engine lose trust in every date on the site, including the accurate ones.
Resources
- Google: Build a sitemap (supported elements)developers.google.com
- Google Search Central: the end of ping and the importance of lastmoddevelopers.google.com
- Bing: sitemaps, lastmod and AI-powered searchblogs.bing.com
- sitemaps.org protocol and W3C: Datetime formatsitemaps.org
- WordPress: wp_sitemaps_posts_entry filterdeveloper.wordpress.org
- Next.js: sitemap filenextjs.org
- Astro: @astrojs/sitemap integrationdocs.astro.build
Updated on
Topic checklist (PDF)