Set a sitemap's lastmod value to the latest significant update of the page it describes, not the time your build ran. If your publishing system cannot establish that date reliably, omit the optional field for that URL. A useful implementation starts with the publication history, then tests whether the generated sitemap tells the same story.
Choose the right clock before changing the generator
A content system can hold several legitimate dates for one page: initial publication, the last editor save, deployment, cache refresh and sitemap generation. They answer different questions. A developer who connects lastmod to the most convenient timestamp may produce perfectly valid XML that misrepresents when readers received a meaningful update. Write down what the existing value actually measures before replacing it.
Google's guidance for building and submitting sitemaps says it uses lastmod when the values are consistently accurate and can be checked against the page. Changes to main content, structured data or page links can be significant; a changed copyright date is not. That distinction is about the published page, rather than how often an automated job touches its record.
Start with three representative URLs: a recently revised article, an unchanged older page and a listing assembled from other records. Compare their live content, editorial revisions and sitemap entries. If all three carry the time of the latest deployment, investigate the source of that value. Matching timestamps are a clue, not proof of a defect: a genuine coordinated update could affect several pages together.
Define what counts as a significant change
Give editors and developers a shared rule they can apply without guessing Google's internal decisions. For an instructional article, replacing an obsolete procedure is a substantive change. For a product page, changing information central to the offer may be substantive. A scheduled rebuild with the same published content does not become an editorial update simply because new files were written to disk.
The following table is a working policy for reviewing your implementation, not an exhaustive list of search-engine rules. Use it to make the team's reasoning explicit. If a change affects structured information or important links rather than visible paragraphs, inspect that part of the page too. A text-only comparison can miss information that the sitemap date is supposed to describe.
| Change being reviewed | Suggested handling of page lastmod |
|---|---|
| A published procedure is corrected substantially | Record the significant publication update |
| Important structured data or page links change | Assess the change and update the date when significant |
| Only the copyright year changes | Keep the previous significant-update date |
| An unchanged page is rebuilt or its cache is refreshed | Do not replace the date with the job time |
| The latest significant update cannot be established | Omit the optional value until reliable evidence exists |
Document the boundary with examples from your own templates. A broad redesign may change important content on some pages while merely changing decoration elsewhere. Avoid a blanket rule that every template deployment is significant, but do not assume template changes can never matter. The person reviewing the release should be able to explain what changed for each affected content family.
Trace the date back to a published revision
Find the field your generator reads and follow it to the event that writes it. A database column named updated_at might change when an editor adjusts an internal note, imports an old record or saves a draft. Its name alone does not establish that it records a published content update. Review application behavior and revision history instead of trusting a label.
Where practical, retain a separate timestamp for the latest significant published revision. Associate it with the content version and a short explanation of the change. This is an implementation recommendation, not a new sitemap requirement. It gives developers a defensible value to export and lets an editor audit a suspicious date without reconstructing the entire deployment pipeline.
Keep draft and live states separate. If a correction has been saved but is scheduled for later publication, do not advance the live URL's date merely because the database already contains the new draft. Check the content version actually served at that URL. For sites with translations, evaluate each published language page against its own revision history rather than automatically copying an update from another language.
Export only the precision you can support
The Sitemap Protocol permits a date in YYYY-MM-DD form without a time component. A system that knows the real publication day but does not retain a dependable time should not invent seconds to make the value look more precise. If you provide a timestamp, serialize it in a supported datetime format with the appropriate timezone information, and test the conversion around day boundaries.
Treat an unknown date as unknown. Do not replace a missing value with today's date, the file creation time after a migration or the oldest timestamp that happens to be available. If a migration preserved genuine revision records, use those records. Otherwise, leaving out this optional field is more honest than manufacturing a history. Google explicitly allows omission for pages whose modification dates cannot be determined reliably.
Validate the final XML, not only the input database values. An otherwise correct date can be serialized incorrectly or attached to the wrong URL. Keep the URL fully qualified, preserve the required sitemap namespace, and escape XML values correctly. The protocol's date describes the linked page's modification; it is separate from HTTP conditional-request handling and should not be treated as an automatic substitute for a server validator.
Keep page dates separate from sitemap index dates
A sitemap index describes sitemap files. Its optional lastmod therefore refers to the modification of the corresponding sitemap file, not directly to every page listed inside it. A page sitemap describes individual URLs. Mixing these two levels can make all pages appear updated whenever an index or a child sitemap is regenerated.
For example, imagine a child sitemap containing many stable articles and one newly revised guide. The child's contents change when that guide's entry is updated. The other articles do not inherit the guide's date. Keep the page-level records intact and determine the index entry from the actual sitemap-file modification. Do not propagate a parent timestamp downward as a convenient default.
Make this distinction visible in your generator's data model and tests. Names such as page_significant_update and sitemap_file_modified are illustrative, but they communicate different responsibilities. A reviewer should be able to follow either value back to its source. If the same helper blindly assigns the current time at both levels, examine that helper before adjusting individual records.
Test changes and non-changes through the whole pipeline
A useful test starts with a saved sitemap and a known published page revision. Rebuild the site without editing that page, then compare the entry. Its page-level date should remain stable. Repeat after a cache refresh or a deployment that only changes unrelated assets. These tests examine your chosen publication policy; they do not predict when Google will crawl the URL.
Next, publish one genuine correction on a test page and check the complete path from revision record to public HTML and sitemap output. Confirm that the new date belongs to that URL, while the unchanged control page retains its earlier value. Test an unpublished draft separately. A draft that advances the public entry exposes a lifecycle bug even if the generated XML passes syntax validation.
Include an unknown-date case and a timezone-boundary case. The first should omit lastmod, rather than quietly substituting the build clock. The second should produce the intended calendar date or timestamp after conversion. Save the input, expected result and actual output so a future CMS upgrade can be checked against the same behavior. No special search-ranking measurement is needed to detect these mismatches.
For the broader checks that determine which URLs belong in the file, use the technical SEO fundamentals guide. Date repair should not distract from inconsistent URL selection or other indexing conditions. Keep those investigations distinct: a correct timestamp does not turn an unsuitable URL into a page that must be crawled, indexed or shown in search results.
Repair the source of bad dates and leave an audit trail
If an audit finds that every deployment overwrites all dates, fix the generator or the upstream publication event before editing the output. Otherwise, the next run will undo the repair. Preserve a copy of the previous sitemap and record the affected URL groups. This gives the release owner something concrete to compare and makes an unintended mass change easier to identify.
Recover accurate dates only where the evidence supports them. For pages with no dependable history, omit the field and start recording future significant updates correctly. Do not backfill guessed dates to create a visually complete column. When the repaired sitemap is available, inspect Search Console's sitemap processing information for access or format problems. A successful read is not proof that every supplied date matches the corresponding page.
Assign ownership of the rule to the publishing workflow, not just the SEO report. Add a short review item to CMS upgrades, imports and template releases: which event changes the page date, and can that event be traced to a significant published update? Keep one unchanged control page in the checks. Its stable value is a useful early warning when a future deployment starts rewriting history again.