Structured data, expiry and listings: a guide for site owners and theme authors
A collection of events, jobs, products or recipes can do more than hold typed fields. It can tell search engines what each entry is (a JSON-LD preset), let entries end on a date of their own (expiry), and list entries by their fields (“upcoming events, soonest first”), on listing pages and in the collection’s own feed.
All three are collection settings: they build on typed custom fields, are approved like any other site setting, and change nothing until a site opts in. The design and its reasons are in RFC-0042 and ADR-0044.
Structured data presets
Without a preset, every entry page describes itself as a BlogPosting. A preset replaces that document with the entry’s real type, built from its fields, and keeps the BreadcrumbList.
| Type | Required (Google) | Typical mapping |
|---|---|---|
Event |
name, startDate, location.name, at least one location.address.* |
startDate ← a datetime field, location.name ← a venue text field or the venue entry’s title (below), eventStatus ← a select |
JobPosting |
title, description, datePosted, hiringOrganization.name, jobLocation.address.* (or jobLocationType with applicantLocationRequirements.name) |
validThrough ← a date field, employmentType ← a select, jobLocationType ← a boolean (true means remote) |
Product |
name, offers.price |
offers.price ← a number field, offers.priceCurrency ← a constant such as EUR |
Recipe |
name, image |
recipeIngredient ← a multiline text field (one per line), recipeInstructions ← rich text (one step per paragraph), times ← whole minutes |
Why these four: they are in Google’s current search gallery, and each describes one item per page, which is exactly an entry page.
FAQPageis not offered. Google deprecated FAQ rich results and stopped showing them in 2026; it was also never a one-item-per-page type.- No ratings or reviews. Google’s policy forbids self-serving review markup and Cloudhal stores no reviews, so
aggregateRatingandrevieware not in the table (a constant could otherwise fake one). Organization/LocalBusinessdescribe the site, not an entry, and belong to site settings later.
Every property takes its value from one of four sources: a field of the collection (its type must fit the property), an entry property (title, summary, body, coverImage, url, publishedAt, updatedAt), a site property (name, url, logo), or a short plain constant (only on enum paths such as eventStatus and on currencies; required values always come from the entry). Many paths have a default (an event’s name is the entry title, a job’s hiringOrganization.name is the site name), so a working Event needs only a start date, a venue and a city.
Values are converted per field type: a datetime gives its instant with its own zone’s offset (2026-11-05T19:30:00+03:00), a date gives YYYY-MM-DD, images become absolute asset URLs, rich text becomes plain text, URLs are made absolute (unsafe ones are dropped), and select options map through the property’s vocabulary (cancelled → https://schema.org/EventCancelled). An option with no meaning there leaves the property out.
Mapping fields
- Studio: a collection’s settings, Structured data. Pick a type, then a source for each property (required first). The card flags mismatches, suggests marking fields mapped to required properties Needed to publish, and reminds you that search engines expect the values to be visible on the page (the starter’s
EntryFieldsshows every field with a value). - Agents (MCP):
update_collectiontakesstructuredData({ "type": "Event", "properties": { "startDate": { "kind": "field", "field": "startsAt" } } }). It waits for a person who may change site settings; trydryRun: truefirst. - API:
PUT /api/sites/:siteId/collections/:key. An invalid preset answers422 structured_data_invalidwith one issue per path.
Values from a referenced entry
A property can read the entry a reference field names (RFC-0045 step 8b), so an event’s venue is typed once, in a places collection, and every event’s JSON-LD reads it:
{ "type": "Event", "properties": { "startDate": { "kind": "field", "field": "startsAt" }, "location.name": { "kind": "reference", "field": "venue", "property": "title" }, "location.address.streetAddress": { "kind": "reference", "field": "venue", "targetField": "street" }, "location.address.addressLocality": { "kind": "reference", "field": "venue", "targetField": "city" }, "location.address.addressCountry": { "kind": "reference", "field": "venue", "targetField": "country" }, "organizer.url": { "kind": "reference", "field": "venue", "property": "url" } } }The page then emits "location": { "@type": "Place", "name": "Grand Hall", "address": { "@type": "PostalAddress", "streetAddress": "…", "addressLocality": "Istanbul", "addressCountry": "TR" } }. Google requires location and location.address for Event rich results, so a venue without an address keeps the page on its BlogPosting.
fieldis a single reference field (not a list) with exactly one target collection.- Exactly one of
propertyandtargetField:propertyis the referenced entry’stitle,urlorsummary, where the path takes that kind of value;targetFieldis a field of the target collection, checked by the same type rules as a field source.
- The entry it reads is the one the page would show: in the page’s language, else the default language’s under
default-with-notice, published and not gated. A translation of the venue reads its original’s non-localized fields. - When there is none (a draft or archived venue, no version in that language), its properties are left out, and a missing required one keeps the
BlogPosting. - Renaming the target’s field renames the source with it, and removing it, or retyping it so that it no longer fits, is refused while a preset reads it.
- On Cloudflare this works once this release’s site Worker is deployed (
cloudhal deploy); a site still served by an older one answers409 reference_listings_unsupportedto a write that adds a reference source.
Checking the result
An entry whose required values are missing emits no preset document (Google treats incomplete items as invalid): its page keeps the BlogPosting, and Studio says which value is missing.
- Studio: the Structured data card’s Preview shows, for a chosen entry, exactly what its page emits with the saved settings, and links to Google’s Rich Results Test for the entry’s public URL.
- Agents:
preview_structured_data { siteId, entryId }(read-only,content:read) returns the document and its issues. Check it before asking for a publish.
Expiry: entries that end on a date
expiry names a date or datetime field and an action. Once an entry’s date has passed, the site treats it as ended. Nothing runs at that moment: no job, no write, no unpublish. Every page view compares the date with the clock, as time gates do, so removing the rule brings every entry back at the next publish.
| Action | Entry page | Lists, contentList, archives, related |
Feeds, sitemap, search, llms.txt |
|---|---|---|---|
unlist (default) |
stays (200), JSON-LD unchanged with its dates in the past | left out (themes can ask for them with includeExpired) |
left out |
hide |
404 no-store, like an expired embargo |
left out | left out |
unlist suits events (pages keep their links and history) and jobs (a JobPosting with validThrough in the past is one of Google’s accepted ways to retire a posting). hide suits offers that must not stay reachable. Neither changes the entry’s status; Studio shows it as ended, and previews show it with an “Ended on …” notice.
- When it ends: a datetime ends at its instant. A date ends at midnight after it in the site’s time zone (
Site.timeZone, UTC when unset), so an event “on 5 November” is listed all of 5 November.afterMinutesadds a grace period of up to 10,080 minutes (one week). An entry without a value never ends. - Your own gates still apply: the entry ends at the earlier of its own
availability.untiland the derived date. - Caching: every ended instant joins the published snapshot’s gate index, so the edge cache expires at each one without a purge. Static builds show the site as of the build and warn when a gate lies ahead; build again then.
- Who decides: the rule is a collection setting (
site:settings). Publishing a change that ends a live entry earlier, or gives it an end, removes content at a set time, so an agent’s publish carrying it waits for a person. - Deploy first on Cloudflare: an older site Worker would ignore the rule and keep showing ended entries. The admin Worker refuses
expiry(409 gates_unsupported, over REST, MCP andcloudhal push) until the site Worker answers{ "gates": 2 }onGET /__cloudhal/features. After upgrading, deploy both Workers (cloudhal deploydoes), then save the rule. Locally and on Node there is nothing to wait for.
Listings by field
listFields names up to four fields a collection may be filtered and sorted by: they are the columns of its list in Studio, the conditions contentList sections and agents may use, and what the gate index watches for now. Conditions are ANDed; values are strings read by the field’s type.
| Field type | where operators |
orderBy |
value |
|---|---|---|---|
number |
eq ne lt lte gt gte set unset |
yes | a decimal |
date |
same | yes | YYYY-MM-DD or now (today in the site’s zone) |
datetime |
same (compares the instant) | yes | an RFC 3339 instant or now |
boolean |
eq (no value reads as false) |
no | true / false |
select |
eq ne in set unset (with multiple: contains, contains any) |
no | option values (values for in, up to 20) |
text, url |
eq set unset |
no | the exact string |
richText, image |
set unset |
no | none |
reference |
eq ne in set unset (with multiple: contains, contains any) |
no | an entry’s groupId (values for in, up to 20) |
References (RFC-0045 step 8a) compare translation group ids, the values a reference stores: “events at this venue” is {"field":"venue","op":"eq","value":"entry_…"}. A member’s own id (a translation’s, as list_entries returns it) reads as its group’s, and a translation filters by its original’s non-localized reference. On Cloudflare a reference listing field and conditions on it work once this release’s site Worker is deployed (cloudhal deploy); a site served by an older one answers 409 reference_listings_unsupported. Studio picks the entry with the editor’s picker, in content list conditions and in the collection list’s filters, and shows the targets’ titles as the column.
One hop through a reference (RFC-0045 step 8c): a condition may name a listing field of the entry a listed reference names, as <reference>.<field>: “events whose venue is in Istanbul” is {"field":"venue.city","op":"eq","value":"Istanbul"}.
- Where it works. The reference has exactly one target collection, and the field is one of that collection’s listing fields (not a reference: one hop only). The operators are the field’s type’s, and the condition counts toward the four.
- Which venue counts. The one the listing’s view shows: in the referring entry’s language, else the default language’s under
default-with-notice. On the site that is a published, not gated entry; in Studio, the API andlist_entries, any entry that is not archived. A translated venue reads its original’s non-localized fields. With a multiple reference, any venue that matches is enough. - No venue, no match. An entry whose reference shows no venue (none chosen, a draft or archived venue on the site, no version in that language under
fallback: none) matches no one-hop condition,neandunsetincluded. Usevenue unsetto find entries without one. - Always current. It is evaluated when the list is read (a join over the listing values, no copy), so a venue’s edit shows in the next listing. Sorting by a referenced field is not offered.
- Guards. While a section filters through a reference, unlisting, removing or retyping the venue’s field or the reference is refused (
409 list_field_in_use), as is pointing the reference at another collection. Renaming either rewrites the condition.
A repeater (a list of items) cannot be a listing field (422 list_field_type). A collection that listed one before keeps it, but no condition can use it: cloudhal import --dry-run and Studio’s “Listing fields” name such fields so you can remove them.
Entries without a value sort last in both directions; ties fall back to the section’s or collection’s sort, then the id. Not offered: text sorting (collation differs between SQL and browsers), contains/LIKE (search covers it), OR, and offsets on now. A translation filters by its original’s non-localized values.
{ "where": [{ "field": "startsAt", "op": "gte", "value": "now" }], "orderBy": { "field": "startsAt", "direction": "asc" } }Everywhere: contentList sections (where, orderBy beside sort and filter), list_entries and GET /api/sites/:siteId/entries (where as JSON, orderBy, limit/cursor), and Studio’s filter bar and sortable columns. Writers check conditions against the collection (422 invalid_query), and a field cannot leave listFields or change type while a section still uses it (409 list_field_in_use, naming the pages). On a published site an invalid query matches nothing and is logged, so a snapshot keeps rendering.
Listing pages
A collection’s index page is an ordinary page with a contentList section, at the collection’s prefix (/events for /events/{slug}). Create listing page in the collection’s settings makes a draft there, titled with the plural label; for a collection with a date listing field and an expiry, the section starts as “upcoming, soonest first”. Agents do the same with create_page. Menus link to it through the renderer’s collectionIndex default, and old themes render it, because pages and ContentList.astro are the renderer’s.
Collection feeds
Each collection with a prefix has its own RSS feed at <prefix>/rss.xml (/events/rss.xml, and /<locale>/events/rss.xml or the locale’s domain for other languages): its newest listed entries, so ended and gated entries stay out, titled after the plural label, with the site feed’s cache tag and edge-cache cap. A collection with feed: false has none (404), and so does one whose permalink has no prefix (/{slug}, whose feed would be the site’s /rss.xml).
The renderer serves it with a middleware that answers only when the theme’s own routes answered 404: a theme with its own route for the path keeps it, and theme copies from before this feature gain the feeds on upgrade. Static builds write the files through the starter’s [...path]/rss.xml route (it lists the paths, answers 404, and the middleware fills in the feed); the Cloudflare site Worker and cloudhal dev answer per request. The starter links the feed (<link rel="alternate" type="application/rss+xml">) on entry pages and on pages that list the collection.
Theme API
All additive (@cloudhal/astro-renderer; see its README’s “Theme-facing API stability”). entryHead, entries(), allEntries() and every older export keep their meaning.
| Export | What |
|---|---|
withStructuredData(head, source, entry, { origin, media? }) (./seo) |
Call after entryHead: replaces the BlogPosting with the collection’s preset when the entry yields one, keeps the breadcrumbs, otherwise returns head unchanged. entryStructuredData returns the document and its issues. |
queryEntries(source, q) (./queries) |
{ collection, locale?, where?, orderBy?, sort?, filter?, limit? (1–100, default 20), offset?, includeExpired? } → { entries, total } on any source; now is the source’s clock. |
contentListEntries(source, sections, locale?) (./queries) |
The entries map Sections reads: by collection, and by section id for sections with a term filter or where/orderBy. |
collectionFeedLink(site, collection, origin, locale?) (./seo, ./collection-feeds) |
{ title, href } for the collection’s feed on the locale’s URL, or undefined without one. Add it to head.feeds after localizeHead, which would otherwise localize the URL twice. |
---const head = await withStructuredData(entryHead(site, entry, origin, terms, media), source, entry, { origin, media });const meta = localizeHead(head, site, { locale, origin, alternates });const feed = collectionFeedLink(site, entry.collection, origin, locale);const shown = feed ? { ...meta, feeds: [...meta.feeds, feed] } : meta;const upcoming = await queryEntries(source, { collection: "events", where: [{ field: "startsAt", op: "gte", value: "now" }], orderBy: { field: "startsAt", direction: "asc" }, limit: 5,});---