Sub topic 2
Update dates only when the content really changed
This chapter assumes you know basic HTML, can read JSON, and have maintained a content or e-commerce site before.
Update dates only when the content really changed
A dateModified value tells readers and crawlers when the meaningful content of a page last changed. Change it only when facts on the page change: a price, a specification, a policy, or a product's stock status. Do not change it for a footer edit, a template update, or a re-saved file. A date that moves without a content change makes the page look fresher than it is, and search systems and AI answer engines can learn to distrust such dates.
Expressing facts in JSON-LD
JSON-LD (JavaScript Object Notation for Linked Data) is a format that places machine-readable facts in a <script type="application/ld+json"> tag. The vocabulary comes from schema.org. This article markup states its publication and modification dates separately:
{
"@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"
}Marking up prices, availability, and product details
A Product holds an Offer, which carries the price, currency, and availability. Generate this markup from the same record that renders the price, so the two cannot drift apart:
import json
from decimal import Decimal
def product_jsonld(p):
availability = ("https://schema.org/InStock" if p["in_stock"]
else "https://schema.org/OutOfStock")
return {
"@context": "https://schema.org",
"@type": "Product",
"name": p["name"],
"sku": p["sku"],
"offers": {
"@type": "Offer",
"price": str(p["price"]),
"priceCurrency": p["currency"],
"availability": availability,
},
}
product = {"name": "Trail Runner 2", "sku": "TR2-BLK-42",
"price": Decimal("89.00"), "currency": "EUR", "in_stock": True}
print(json.dumps(product_jsonld(product), indent=2))Keeping markup and visible text in agreement
Each fact should appear in the visible page and the markup with the same value:
| Fact | Visible text | JSON-LD property |
|---|---|---|
| Price | 89.00 EUR | `offers.price` and `offers.priceCurrency` |
| Stock | In stock | `offers.availability` |
Exercise
A product drops from 89.00 EUR to 79.00 EUR, and the description text is otherwise unchanged. Which date should change, and which values must match?
Show answer
The dateModified value should change, because the price is a meaningful content change. The visible price and offers.price must both show 79.00, and offers.priceCurrency must still be EUR.