Sub topic 4
Publish dates versus last-modified dates
This chapter assumes you can read JSON and basic HTML, and that you have edited pages on a content or e-commerce site. Earlier chapters covered which facts go stale and why each fact should live in one place. Here we look at two facts every article has: when it first appeared and when it last changed.
Two dates, two different questions
A page carries two dates that answer different questions.
- Publish date answers "When did this page first become public?" It is set once and does not change.
- Last-modified date answers "When did the content last change in a way a reader would care about?" It moves forward each time that happens.
Readers, search engines, and AI answer systems use both. A reader deciding whether to trust a tutorial about a software version wants the modified date. A journalist citing the original announcement wants the publish date. If you collapse both into one field, one of those audiences gets the wrong answer.
The rule that follows is simple. The modified date is never earlier than the publish date. Both are real events you can point to in your history, not labels you pick for effect.
Where the dates come from
Dates should come from your content system's record of events, not from someone typing them into a template. This applies the single-source-of-truth idea from the previous chapter. Store two timestamps per page and render them everywhere.
| Field | Set when | Changes later? |
|---|---|---|
| `published_at` | The page is first made public | No, except to correct an error |
| `modified_at` | A meaningful edit is saved and published | Yes, on each meaningful edit |
Two details cause most of the trouble in practice.
- Draft time is not publish time. A page may be drafted in January and go live in March. The publish date is March. If your system stores the creation time of the draft, expose a separate
published_atfield and fill it at the moment of going live. - A file's modification time is not the content's modification time. A deploy, a template change, or a bulk find-and-replace on file timestamps touches every page. If you derive
modified_atfrom the filesystem, every release will make every page look freshly updated. Store the editorial change time explicitly.
What counts as a "meaningful" edit is the subject of the next chapter. For now, treat modified_at as a field that only an editorial rule or a person can advance.
Formats and time zones
Use ISO 8601 timestamps with an explicit UTC offset, such as 2026-11-20T08:00:00+00:00. A date with no offset is ambiguous. A page updated late in the evening in one region is "tomorrow" in another, and crawlers will interpret an offset-free value in unpredictable ways.
A few habits keep things predictable:
- Store timestamps in UTC and convert only for display.
- Include the time as well as the date in machine-readable fields. Two edits on the same day then stay distinguishable.
- Keep the visible date human-readable ("20 November 2026") and the machine-readable one exact.
In HTML, the time element carries both forms:
<p>
Published <time datetime="2026-03-02T09:00:00+00:00">2 March 2026</time>.
Updated <time datetime="2026-11-20T08:00:00+00:00">20 November 2026</time>.
</p>The visible text and the datetime attribute describe the same instant. Because both come from the same stored value, they cannot disagree.
Showing both dates to the reader
Show the dates where a reader can see them, usually near the title or byline. A few conventions help:
- Label them. "Published" and "Updated" are clearer than a bare date, which readers cannot interpret.
- Show the updated date only if it differs from the publish date in a way that matters. Showing "Updated" with the same day as "Published" adds noise.
- For content whose accuracy depends on time, such as pricing guides, version-specific tutorials, or legal summaries, make the updated date prominent. A short note on what changed ("Updated for version 4.2") is more useful than a date alone.
Visible dates are also the evidence that markup must match. A crawler that finds dateModified in JSON-LD but no corresponding date on the page has less reason to believe it.
Expressing both dates in JSON-LD
Structured data uses the schema.org properties datePublished and dateModified on an Article (or a subtype such as BlogPosting or NewsArticle). The full treatment of JSON-LD comes in a later chapter. Here is the dates-only core:
{
"@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"
}Points to check:
datePublishedis required in spirit for any article you want understood as time-bound.dateModifiedis optional, so omit it if the page has never changed rather than repeating the publish date. You can include it equal to the publish date if your template always emits both, but never invent a later one.- Both values must match what the visible page says.
- If the page is regenerated on each request, make sure the template reads the stored timestamps. A template that calls "now" for
dateModifiedwill report a new modification on every crawl.
Generating dates from one record
This Python example renders the visible text and the JSON-LD from the same page record. It also refuses to produce output if the timestamps are inconsistent, so errors surface at build time and not in search results.
from datetime import datetime
import json
def load_dates(page):
published = datetime.fromisoformat(page["published_at"])
modified = datetime.fromisoformat(page["modified_at"])
if published.tzinfo is None or modified.tzinfo is None:
raise ValueError("timestamps must include a UTC offset")
if modified < published:
raise ValueError("modified_at is earlier than published_at")
return published, modified
def visible_dates(page):
published, modified = load_dates(page)
text = f"Published {published.day} {published:%B %Y}"
if modified.date() > published.date():
text += f" | Updated {modified.day} {modified:%B %Y}"
return text
def article_jsonld(page):
published, modified = load_dates(page)
data = {
"@context": "https://schema.org",
"@type": "Article",
"headline": page["title"],
"datePublished": published.isoformat(),
}
if modified > published:
data["dateModified"] = modified.isoformat()
return data
page = {
"title": "How to choose trail running shoes",
"published_at": "2026-03-02T09:00:00+00:00",
"modified_at": "2026-11-20T08:00:00+00:00",
}
print(visible_dates(page))
print(json.dumps(article_jsonld(page), indent=2))Running it prints the label "Published 2 March 2026 | Updated 20 November 2026" followed by JSON-LD that carries the same two instants. The visible label compares dates and the markup compares full timestamps, so a same-day edit adds dateModified to the markup without adding noise to the page.
How the dates flow through your system
The sitemap and HTTP branches get their own chapters. The point here is that all four outputs read the same two values. If one of them is typed by hand somewhere, it will drift.
Common errors
- Overwriting the publish date on edit. Some content systems reset
published_atwhen a page is saved. The original date is lost, and the page looks brand new. Makepublished_atwrite-once. - Using "now" at render time. Templates that print the current time as the modified date produce a page that is always "updated today". Crawlers can detect the pattern, and readers lose a signal they depend on.
- Mismatched values across surfaces. The visible text says March, the JSON-LD says November, the sitemap says today. Which one is right is unclear, so none is trusted.
- Missing or inconsistent offsets.
2026-11-20T08:00:00in one place and2026-11-20T08:00:00+01:00in another describe different moments. - Backdating. Setting an early publish date to appear established, or a recent modified date to appear fresh, misrepresents the page. It also tends to fail on checks that compare dates against archived copies.
- Dropping the original date after a rewrite. If a page is substantially rewritten, keep the original
datePublishedand advancedateModified. If it is really a new article, publish it as a new page and link the old one.
Correcting mistakes
Sometimes the stored publish date really is wrong, for example after a migration that set every page to the migration day. Fixing it is legitimate. Find the true original date from your archives or version history, correct published_at once, and record the reason in your change log. The fix is a data repair and should not advance modified_at, because no reader-facing content changed.
Exercise
A site's template prints the current time as dateModified every time a page is rendered, and the content system overwrites published_at whenever an editor saves. Name the two problems this causes and what each field should do instead.
Show answer
Using the render time makes every page appear updated on every crawl, so dateModified no longer signals a real change. It should read the stored modified_at, which advances only when a meaningful edit is published. Overwriting published_at on save erases the page's original publication date. It should be set once when the page first goes live and stay fixed, apart from a one-time correction of a verified error.
Exercise
A page has published_at of 2026-03-02T09:00:00+00:00 and modified_at of 2026-03-02T09:00:00+00:00. Should its JSON-LD include dateModified, and should the visible text show an "Updated" label?
Show answer
The page has never changed since publication, so omitting dateModified is the cleanest choice, although repeating the publish value is acceptable if the template always emits it. The visible text should not show an "Updated" label, because there is no later change to report.