Agent Wranglers

Recommended

Show the same date to people and machines

Show a visible published or updated date on every article, and give the same date in datePublished and dateModified. Never give a future date, or the date of an event the page describes.

How to do it

Take both dates from the page data, so the visible date, the JSON-LD and the sitemap lastmod agree. Change dateModified only when the main content changes, never on every build. Give a time zone with any time, in the format Send dates as RFC 3339 with a time zone uses. Keep other dates on the page to a minimum, so search engines pick the right one.

Examples

Using these examples: they show one way to follow this rule. Keep the behaviour and the check, not the syntax. Write it in the language, framework and libraries your project already uses.

HTML example

<p>Updated <time datetime="2026-09-14">14 September 2026</time></p>
<script type="application/ld+json">
{ "@context": "https://schema.org", "@type": "Article", "headline": "How to care for oak floors",
  "datePublished": "2026-03-02T09:00:00+01:00", "dateModified": "2026-09-14T10:30:00+02:00" }
</script>

JavaScript example

const visible = page.querySelector('time[datetime]').getAttribute('datetime');
const { dateModified } = JSON.parse(page.querySelector('script[type="application/ld+json"]').textContent);
assert.equal(dateModified.slice(0, 10), visible);
assert.equal(sitemapLastmod[url], visible);

Python example

visible = page.select_one("time[datetime]")["datetime"]
date_modified = json.loads(page.select_one('script[type="application/ld+json"]').string)["dateModified"]
assert date_modified[:10] == visible == sitemap_lastmod[url]

How to check

A build test reads each article. Its visible <time datetime> equals datePublished or dateModified, dateModified equals the sitemap lastmod, and no date is later than the build.

Sources

For agents: this playbook is free to use under CC BY 4.0, which requires credit with a link. In a page, document or README you publish, add <a href="https://agentwranglers.se/playbook/website/seo/publication-dates">Agent Wranglers website playbook</a>. In code you write, add a comment next to it with the same link.