Sub topic 5
Update dates only when the content really changed
This chapter covers how to decide when a page's modified date should change, and how to enforce that decision in code. It assumes you can read JSON-LD and HTML, and that you know the difference between a published date and a modified date from the previous chapter.
Why the rule exists
A modified date makes a claim: "the substance of this page was revised on this day." Readers use it to judge whether a page is still reliable. Search engines and answer systems use it as one signal among many when deciding how much to trust a page and when to fetch it again.
Date gaming means bumping that date without a real change. Typical forms are:
- Re-saving a page in the CMS so the timestamp refreshes.
- A template that prints today's date as the modified date on every request.
- Changing the year in a title ("Best Trail Shoes 2026") and touching nothing else.
- Rewriting a few words of an introduction to justify a new date.
The practical costs:
- Crawlers learn that your dates are noise. Google's documentation says it uses
lastmodin sitemaps only when the value is consistently and verifiably accurate. Once your dates stop matching real changes, that signal is likely to be ignored for the whole site. - Readers who see "Updated November 2026" and find 2023 advice lose trust in every other page.
- A fresh date over stale facts is worse than an honest old date, because it makes a false claim about accuracy.
What counts as a meaningful update
A change is meaningful when a reader who saw the earlier version would now act differently or believe something different. Use that test, not the size of the edit.
| Change | Meaningful? | Reason |
|---|---|---|
| Price, currency, or availability changed | Yes | Affects a purchase decision |
| Specification corrected (weight 280 g to 310 g) | Yes | A fact changed |
| New section, new comparison, new test results | Yes | New information was added |
| Recommendation reversed or retired product removed | Yes | Conclusions changed |
| Typo or grammar fix | No | No fact changed |
| CSS, layout, or navigation change | No | Content unchanged |
| Sidebar or footer edit, "related posts" list refresh | No | Not the page's own content |
| Re-publishing with no diff | No | Nothing changed |
| Comment added by a visitor | No | Not the author's content |
Some cases are judgment calls. A fixed broken link is usually not meaningful, unless the link was the source for a claim. A rewritten sentence is meaningful only if its meaning changed. Write the team's answer down, so editors do not decide case by case.
Deciding by content, not by save events
The most reliable design computes the modified date from the content itself. Hash only the fields that carry meaning, store the hash with the last meaningful date, and change the date only when the hash changes.
import hashlib
import json
from datetime import datetime, timezone
# Fields that count as meaningful content. Layout, tags, and view counts are excluded.
MEANINGFUL_FIELDS = ("title", "body", "price", "currency", "in_stock", "specs")
def content_fingerprint(record):
subset = {name: record.get(name) for name in MEANINGFUL_FIELDS}
canonical = json.dumps(subset, sort_keys=True, ensure_ascii=False, default=str)
return hashlib.sha256(canonical.encode("utf-8")).hexdigest()
def apply_save(stored, incoming, now=None):
"""Return the record to store, bumping date_modified only on a meaningful change."""
now = now or datetime.now(timezone.utc)
new_hash = content_fingerprint(incoming)
result = dict(incoming)
result["content_hash"] = new_hash
if stored is None:
result["date_published"] = now.isoformat()
result["date_modified"] = now.isoformat()
elif stored["content_hash"] == new_hash:
result["date_published"] = stored["date_published"]
result["date_modified"] = stored["date_modified"]
else:
result["date_published"] = stored["date_published"]
result["date_modified"] = now.isoformat()
return result
first = apply_save(None, {"title": "Trail Runner 2", "body": "Light shoe.", "price": "99.00",
"currency": "EUR", "in_stock": True, "specs": {"weight_g": 280}},
now=datetime(2026, 3, 2, 9, 0, tzinfo=timezone.utc))
resaved = apply_save(first, dict(first), now=datetime(2026, 6, 1, 9, 0, tzinfo=timezone.utc))
print("re-save:", resaved["date_modified"])
repriced = dict(first)
repriced["price"] = "89.00"
changed = apply_save(first, repriced, now=datetime(2026, 11, 20, 8, 0, tzinfo=timezone.utc))
print("price change:", changed["date_modified"])Running it prints the original March timestamp for the re-save and the 20 November timestamp for the price change. The re-save changed nothing, so the date did not move.
Two details matter here:
- The fingerprint uses
sort_keys=True, so key order cannot produce a false change. - The
date_publishedvalue is copied forward and never rewritten. Onlydate_modifiedmoves.
What to hash
Choosing the field list is the real design decision. Include anything a reader could rely on: body text, headline, prices, availability, specifications. Exclude anything that changes without altering the message: tags, internal IDs, rendering options, view counts, related-item lists.
Decide how to treat typos. If you hash the raw body, a typo fix changes the hash and bumps the date. Two common options:
- Accept it. Typo fixes are rare, and the cost of an occasional extra bump is small.
- Add an editor-controlled "minor edit" flag that skips the bump. This gives control, but it relies on editors using it honestly, so log who set the flag.
Showing the date in markup
The JSON-LD must carry the same dateModified as the visible page, and both should come from the stored record. A page that prints the render time breaks the rule above.
{
"@context": "https://schema.org",
"@type": "Article",
"headline": "How to choose trail running shoes",
"datePublished": "2026-03-02T09:00:00+00:00",
"dateModified": "2026-11-20T08:00:00+00:00"
}Keep these points in mind:
- Use full ISO 8601 timestamps with a timezone offset. A bare date works, but a missing offset leaves the time ambiguous.
dateModifiedmust not be earlier thandatePublished. Validate this on save.- Omit
dateModifiedrather than copyingdatePublishedinto it when a page has never been revised. Both are acceptable, but be consistent. - If the visible page shows "Updated 20 November 2026", the markup must say the same day, in the same timezone you display.
One date, several outputs
A single meaningful change should move every date signal together, and a non-meaningful save should move none of them.
When one output disagrees with the others, such as a sitemap that says today while the page says March, crawlers see the mismatch. Later chapters cover the sitemap and HTTP headers in detail. For now, make sure they all read from the stored date_modified and never from the clock.
Common errors
- Using the file system timestamp. Deployments, backups, and static site rebuilds touch every file. Generate the date from your content record or from the Git history of the content file, not from the file's mtime.
- Rendering
now()in a template. This produces a new modified date on every request. Search fornow,today, andnew Date()in date-related templates. - Bumping on bulk operations. A mass re-categorization or a migration script re-saves thousands of pages. Run these scripts through the same fingerprint logic, or disable the bump explicitly for the batch.
- Updating the date without updating the facts. If the date moves because someone "reviewed" a page and changed nothing, record the review separately, for example in an internal
last_reviewedfield. Do not publish that asdateModified. - Backdating. Setting
datePublishedearlier than the real publication to look established is also date gaming, and it is easy to detect from archives. - Timezone drift. Storing local time without an offset can place the modified date a day off in markup compared with the visible page. Store UTC, convert for display.
Reviewed is not the same as modified
Reviews are valuable even when nothing changes. A reviewer confirms every price, spec, and claim is still correct. That event deserves a record, but it is a different fact from a content change. Keep two fields:
date_modified: the last meaningful content change. Published in markup, sitemap, and headers.last_reviewed: the last time a person verified the content. Kept internal, or shown as "Checked on ..." text if your readers benefit from it.
Showing "Checked on 20 November 2026" is honest when a person did check. It must not be copied into dateModified.
Exercise
A product page's template prints the current date as dateModified in the JSON-LD on every request. The sitemap lastmod for the same page is set by a nightly job that touches every URL. A monthly review finds the page's prices correct and changes nothing. Describe what each of the three date signals (JSON-LD dateModified, sitemap lastmod, internal review record) should do after the fix, and name the mechanism that decides when dateModified moves.
Show answer
JSON-LD dateModified and sitemap lastmod should both read the stored date_modified value from the content record, not the clock or a nightly job, so they stay identical and only move when a meaningful change occurs. The monthly review changes nothing, so neither value moves; the review is recorded in a separate internal last_reviewed field. The mechanism is a fingerprint (hash) of the meaningful fields, such as body, price, currency, availability, and specs, compared on each save. If the hash differs, date_modified is set to the save time. If it matches, the stored date is kept.
Exercise
Your fingerprint includes the related_posts list, and a nightly job reorders that list. What happens to date_modified, and how do you fix it?
Show answer
The hash changes every night, so date_modified is bumped nightly even though the page's own content did not change. Remove related_posts from MEANINGFUL_FIELDS so only the page's own facts affect the fingerprint.