diff --git a/.changeset/remove-role-cascades.md b/.changeset/remove-role-cascades.md new file mode 100644 index 00000000..fed1e30d --- /dev/null +++ b/.changeset/remove-role-cascades.md @@ -0,0 +1,47 @@ +--- +'@tanstack/cms-core': minor +'@tanstack/cms-ui-react': minor +'@tanstack/cms-ui-dom': minor +--- + +**Breaking, and silent:** content roles are no longer guessed from field +names. Pages keep rendering, but collections that don't declare their roles +lose these values with no error: + +- `cmsHead` / `cmsJsonLd`: the meta and OpenGraph description, the social + image, JSON-LD `datePublished`, and the JSON-LD author. They no longer try + fields named `excerpt`/`description`/`summary`/`subheading`, + `hero`/`image`/`coverImage`/`featuredImage`/`cover`, + `publishedDate`/`publishAt`/`date`, or `author`, and no longer take the first + block's `subheading` or `image`. The title reads only `titleField`, not a + field named `title` as well. +- The on-page post editor and the home page's post cards: the summary and + byline. Without a collection, the on-page editor only assumes `title`. +- `getSummaryField()` and `getBylineField()` return only the declared + `summaryField` / `bylineField`. + +What's still inferred is one rule per role, on field types: the first `image` +field is the image, the first `markdown` or `richtext` field (other than the +summary) is the body, the first `blocks` field holds the blocks, and a field +named `slug` is the slug. Everything else must be declared (`summaryField`, +`bylineField`, `dateField`, …). + +Built-in blocks read one field name each. `renderBlockToHtml` / +`renderBlocksToHtml` (`@tanstack/cms-ui-dom`) now match the React renderer and +the docs: the `image` block reads `image` (was `src`), the `callout` block +reads `markdown` (was `body`), and the aliases `hero.headline`, +`hero.subheadline`, `richText.body`, `quote.body`, and `quote.author` are gone. +The React `callout` block no longer reads `body`. + +To keep today's output, declare the roles the fallbacks used to pick with the +codemod from a TanStack/cms checkout, review the diff, then upgrade: + +```sh +pnpm codemod explicit-roles --dry /path/to/your/app +pnpm codemod explicit-roles /path/to/your/app +``` + +Blocks-only collections have no field to declare for the description or image +that used to come from the first block. Add an `seoField()` (and fill +`seo.description` / `seo.image`), or a summary or image field declared as the +role. diff --git a/.claude/skills/emdash-to-tanstack-cms/SKILL.md b/.claude/skills/emdash-to-tanstack-cms/SKILL.md index 58e17f36..911b1c98 100644 --- a/.claude/skills/emdash-to-tanstack-cms/SKILL.md +++ b/.claude/skills/emdash-to-tanstack-cms/SKILL.md @@ -230,8 +230,8 @@ tables you used, the Portable Text coverage, how the content was loaded, and a - **Hierarchical taxonomies** — flattened into a `multiselect` (parents lost), or modelled as a collection + `relation`. Taxonomy archive pages (`/category/`) need an app route (`queryDocuments({ where })`). -- **Bylines** — the built-in post page renders the plain-text `author` field, - not the `authors` relation; byline roles and ordering beyond the array order +- **Bylines** — the built-in post page renders the plain-text `author` field + (declared as `bylineField`), not the `authors` relation; byline roles and ordering beyond the array order need app work. - **Menus / widget areas / sections / settings** — site chrome with no core analogue; rebuild in app code or a singleton collection (`isSingleton`). diff --git a/docs/agents/on-page-editor.md b/docs/agents/on-page-editor.md index c95d01dc..de48168a 100644 --- a/docs/agents/on-page-editor.md +++ b/docs/agents/on-page-editor.md @@ -24,7 +24,7 @@ Three components from `@tanstack/cms-ui-react/site` drive this: - **`InteractiveDocument({ id, doc, collection })`** (also exported as `unstable_InteractiveDocument`) automatically dispatches to `InteractivePageContent` when the collection defines a `blocks` field (`collection.blocksField` or its first `blocks` field), or `InteractivePostContent` otherwise, and disables inline editing for read-only collections (such as `createMarkdownStorage`). - **`InteractivePageContent({ id, doc, collection? })`** (also `unstable_InteractivePageContent`) renders and edits a page's title and blocks array (`collection.blocksField`, default `'blocks'`). `collection` defaults to `'page'`. -- **`InteractivePostContent({ id, doc, collection? })`** (also `unstable_InteractivePostContent`) renders and edits a flat document's configured field roles: `titleField`, `bylineField` (fallback `author`), `summaryField` (fallback `excerpt`/`description`), `imageField` (fallback first `image` field), and `bodyField` (fallback first `markdown` or `richtext` field). `collection` defaults to `'post'`. +- **`InteractivePostContent({ id, doc, collection? })`** (also `unstable_InteractivePostContent`) renders and edits a flat document's declared field roles: `titleField`, `bylineField`, `summaryField`, `imageField` (default: the first `image` field), and `bodyField` (default: the first `markdown` or `richtext` field). Undeclared bylines and summaries aren't shown. `collection` defaults to `'post'`. ## Who Sees What diff --git a/docs/api/cms-core.md b/docs/api/cms-core.md index ee30b37e..2ae99b30 100644 --- a/docs/api/cms-core.md +++ b/docs/api/cms-core.md @@ -485,7 +485,7 @@ interface CmsJsonLdOptions { } ``` -schema.org data for a document: `headline` (article types) or `name`, `description` (the `summaryField`), `image`, `url`, `datePublished` (the `dateField`; without one, `publishedDate`, `publishAt`, or `date`), `dateModified` (`_updatedAt`), and `author` (the `bylineField`). +schema.org data for a document: `headline` (article types) or `name`, `description` (the `summaryField`), `image`, `url`, `datePublished` (the `dateField`), `dateModified` (`_updatedAt`), and `author` (the `bylineField`). ### `seoField()` @@ -598,9 +598,9 @@ function slugify(input: string): string function getBlocksField(collection: Collection): string | undefined // blocksField, else first `blocks` field function getImageField(collection: Collection): string | undefined // imageField, else first `image` field function getSlugField(collection: Collection): string | undefined // slugField, else a field named `slug` -function getSummaryField(collection: Collection): string | undefined // summaryField, else `excerpt`/`description`/`summary`/`subheading` -function getBylineField(collection: Collection): string | undefined // bylineField, else a text field named `author` -function getBodyField(collection: Collection): string | undefined // bodyField, else first `markdown`, then `richtext`, field +function getSummaryField(collection: Collection): string | undefined // summaryField +function getBylineField(collection: Collection): string | undefined // bylineField +function getBodyField(collection: Collection): string | undefined // bodyField, else first `markdown` or `richtext` field that isn't the summary function getDateField(collection: Collection): string | undefined // dateField function getCollectionRoles(collection: Collection): CollectionRoles // { title, slug, blocks, image, summary, byline, body, date } function normalizeFieldOptions(options?: ReadonlyArray): Array diff --git a/docs/api/cms-ui-react.md b/docs/api/cms-ui-react.md index 690a7afe..0d38e378 100644 --- a/docs/api/cms-ui-react.md +++ b/docs/api/cms-ui-react.md @@ -314,7 +314,7 @@ The on-page editor components are exported from `@tanstack/cms-ui-react/site` (w | --- | --- | | `InteractiveDocument` (`unstable_InteractiveDocument`) | `({ id, doc, collection })`. Dispatches to `InteractivePageContent` when the collection defines a `blocks` field (`blocksField`, or its first `blocks` field) or to `InteractivePostContent` otherwise, and disables inline editing for read-only collections. | | `InteractivePageContent` (`unstable_InteractivePageContent`) | `({ id, doc, collection? = 'page' })`. Renders a page's blocks with on-page editing for sessions with `content.write`: hold Ctrl or Option and click a title or block to edit inline, reorder, add, or remove blocks, or ask AI to edit the selection or the whole page. Reads and writes the collection's blocks field (`blocksField`, or its first `blocks` field). | -| `InteractivePostContent` (`unstable_InteractivePostContent`) | `({ id, doc, collection? = 'post' })`. The same for flat documents. It edits the title (`titleField`), byline (`bylineField`, or a text field named `author`), summary (`summaryField`, or `excerpt`/`description`), featured image (`imageField`, or the first `image` field), and body (`bodyField`, or the first `markdown`, then `richtext`, field). | +| `InteractivePostContent` (`unstable_InteractivePostContent`) | `({ id, doc, collection? = 'post' })`. The same for flat documents. It edits the collection's roles: title (`titleField`), byline (`bylineField`), summary (`summaryField`), featured image (`imageField`, or the first `image` field), and body (`bodyField`, or the first `markdown` or `richtext` field). An undeclared byline or summary isn't shown. | | `SelectedPageObject` (`unstable_SelectedPageObject`) | `{ kind: 'title' } \| { kind: 'block'; index; focusField? } \| null` | | `SelectedPostObject` (`unstable_SelectedPostObject`) | `{ kind: 'field'; field: string } \| null` | | `unstable_WebMcpBadge` | Exposes the agent tools to in-browser agents through WebMCP (MCP-B), for sessions with `agent.use`. Tool calls go to `POST /api/cms` and their writes are staged for review. The package root route renders it. | diff --git a/docs/deployment/upgrading.md b/docs/deployment/upgrading.md index 61959817..e0eedf1d 100644 --- a/docs/deployment/upgrading.md +++ b/docs/deployment/upgrading.md @@ -190,7 +190,7 @@ import { BlocksView, SiteShell } from '@tanstack/cms-ui-react/site' - **JSON-LD and `og:type`.** These used to switch on a collection named `post`. Set `schemaType: 'BlogPosting'` (or `'Article'`, …) on the collection instead. Without it, documents are a `WebPage` with `og:type` `website`. - **The "View" link.** The admin's "View page" and "View post" links are replaced by one "View on site" link, which appears for any collection that defines `path`. -- **The on-page editor and starter home page.** These read the collection's `titleField`, `bylineField`, `summaryField`, `imageField`, and `bodyField`. Each falls back to the old conventions (`author`, `excerpt`, the first `image` field, the first `markdown` field), so existing collections keep working. +- **The on-page editor, starter home page, and `cmsHead`.** These read the collection's declared roles: `titleField`, `bylineField`, `summaryField`, `imageField`, `bodyField`, and `dateField`. Nothing is guessed from field names (`author`, `excerpt`, `hero`, `publishedDate`, …) or from the first block. Declare the roles; `pnpm codemod explicit-roles ` (from a TanStack CMS checkout) sets them to what the old fallbacks picked. ### 12. AI, MCP, and Start are optional peers diff --git a/docs/schema/blocks-and-rendering.md b/docs/schema/blocks-and-rendering.md index a0cf6ac1..f36dc4b4 100644 --- a/docs/schema/blocks-and-rendering.md +++ b/docs/schema/blocks-and-rendering.md @@ -112,7 +112,7 @@ All built-ins are styled with the `--cms-*` theme tokens (see [Theming](./themin | `richText` | `markdown` | GFM prose. | | `image` | `image`, `caption` | Figure with caption. | | `cta` | `heading`, `label`, `href` | Call-to-action panel with an accent button. | -| `callout` | `tone`, `title`, `markdown` (or `body`) | Bordered aside with a tone badge. | +| `callout` | `tone`, `title`, `markdown` | Bordered aside with a tone badge. | | `code` | `code`, `language`, `filename` | Code panel with a filename/language header. | | `columns` | `left`, `right` | Two responsive Markdown columns. | | `embed` | `url`, `title`, `caption` | Link card for external content. | diff --git a/docs/schema/building-pages.md b/docs/schema/building-pages.md index 065c086d..35d6cf88 100644 --- a/docs/schema/building-pages.md +++ b/docs/schema/building-pages.md @@ -226,8 +226,10 @@ Package components build admin links with `adminPath('/content')`, which reads ` `cmsHead(doc, options)` returns `{ meta, links, scripts }` for a route's `head()`: - `` as `"<title> · <site name>"`, from the collection's `titleField`. -- `description`, from the collection's `summaryField`. Without a declared one: `excerpt`, `description`, `summary`, `subheading`, or the first block's `subheading`. -- OpenGraph and Twitter tags, with the image from the collection's `imageField`. Without a declared one: the first `image` field, `hero`, `image`, `coverImage`, `featuredImage`, `cover`, or the first block image. Root-relative images become absolute against `canonicalUrl`. +- `description`, from the collection's `summaryField`. +- OpenGraph and Twitter tags, with the image from the collection's `imageField` (default: its first `image` field). Root-relative images become absolute against `canonicalUrl`. + +Nothing else stands in: a page built only from blocks has no description or image unless it declares a `summaryField`/`imageField` or fills its `seo` group. - `<link rel="canonical">` and `og:url` from `canonicalUrl`. - `noindex, nofollow` for unpublished documents (disable with `noIndexDrafts: false`) and for `seo.noindex`. - A JSON-LD `<script>` with `jsonLd: true` (derived with `cmsJsonLd`) or `jsonLd: { … }` (used as-is). diff --git a/docs/schema/collections-and-fields.md b/docs/schema/collections-and-fields.md index 9b14f182..28cdf519 100644 --- a/docs/schema/collections-and-fields.md +++ b/docs/schema/collections-and-fields.md @@ -133,17 +133,17 @@ export const cms = defineCms({ | `slugField?` | `string` | Field used for slug lookups. Defaults to a field named `slug` (`getSlugField()`). | | `blocksField?` | `string` | Field holding the page body. Defaults to the first `blocks` field (`getBlocksField()`). | | `imageField?` | `string` | Featured image for thumbnails, the on-page editor, `cmsHead`, and JSON-LD. Defaults to the first `image` field (`getImageField()`). | -| `summaryField?` | `string` | Short summary for cards, meta descriptions, and the on-page editor. Defaults to a field named `excerpt`, `description`, `summary`, or `subheading` (`getSummaryField()`). | -| `bylineField?` | `string` | Author name for bylines and JSON-LD `author`. Defaults to a text field named `author` (`getBylineField()`). | -| `bodyField?` | `string` | Long-form body of a flat (non-block) document. Defaults to the first `markdown` field, then the first `richtext` field (`getBodyField()`). | -| `dateField?` | `string` | Publication date for JSON-LD `datePublished` (`getDateField()`). Without it, `cmsJsonLd` tries `publishedDate`, the scheduled `publishAt`, then `date`. | +| `summaryField?` | `string` | Short summary for cards, meta descriptions, and the on-page editor (`getSummaryField()`). No default. | +| `bylineField?` | `string` | Author name for bylines and JSON-LD `author` (`getBylineField()`). No default. | +| `bodyField?` | `string` | Long-form body of a flat (non-block) document. Defaults to the first `markdown` or `richtext` field that isn't the `summaryField` (`getBodyField()`). | +| `dateField?` | `string` | Publication date for JSON-LD `datePublished` (`getDateField()`). No default. | | `schemaType?` | `string` | schema.org type for JSON-LD, e.g. `'BlogPosting'`. Article types also set `og:type` to `article`. Defaults to `'WebPage'`. | | `migrations?` | `Array<ContentMigration>` | Data migrations for stored documents (see [Content migrations](#content-migrations)). | | `access?` | `CollectionAccess` | Narrow who can `read`, `write`, `create`, `update`, `publish`, or `delete` (see [Access control](#access-control)). | | `hooks?` | `CollectionHooks` | Lifecycle hooks (see [Hooks](#hooks)). | | `admin?` | `{ columns?, defaultSort? }` | Admin list defaults. `columns` is the default set of extra columns after the title (editors can toggle them with the column picker); `defaultSort` is `{ field, dir? }` (default: most recently updated first). | -`imageField`, `summaryField`, `bylineField`, `bodyField`, and `dateField` are the collection's content **roles**: what post cards, the on-page editor, and `cmsHead` read. Declare them. A declared role is the only field `cmsHead` reads for it, even when that field is empty for a document. `getCollectionRoles(collection)` returns every role at once. The name-based defaults are going away: run `pnpm codemod explicit-roles <path-to-your-app>` from a TanStack CMS checkout to declare what they pick today. +`imageField`, `summaryField`, `bylineField`, `bodyField`, and `dateField` are the collection's content **roles**: what post cards, the on-page editor, and `cmsHead` read. Declare them. Nothing is guessed from field names: an undeclared summary, byline, or date is empty, and a block never stands in for a document field. The only defaults are single rules on field types: the first `image` field is the image, the first `markdown` or `richtext` field is the body, the first `blocks` field holds the blocks, and a field named `slug` is the slug. `getCollectionRoles(collection)` returns every role at once. To declare what the removed name-based fallbacks used to pick, run `pnpm codemod explicit-roles <path-to-your-app>` from a TanStack CMS checkout. ## Field types diff --git a/packages/core/src/lib/seo.ts b/packages/core/src/lib/seo.ts index ddc69197..c4e44bf2 100644 --- a/packages/core/src/lib/seo.ts +++ b/packages/core/src/lib/seo.ts @@ -10,6 +10,7 @@ import { collections, getBylineField, + getDateField, getImageField, getSummaryField, isArticleSchemaType, @@ -212,8 +213,7 @@ export function cmsJsonLd<TDoc extends object = Doc>( const out: Record<string, unknown> = { '@context': 'https://schema.org', '@type': type, - [isArticle ? 'headline' : 'name']: - seo.title ?? (str(rec[titleField]) || str(rec.title)), + [isArticle ? 'headline' : 'name']: seo.title ?? str(rec[titleField]), } const description = seo.description ?? resolveDescription(rec, collection) if (description) out.description = description @@ -226,8 +226,7 @@ export function cmsJsonLd<TDoc extends object = Doc>( if (published) out.datePublished = published const modified = str(rec._updatedAt) if (modified) out.dateModified = modified - const bylineField = collection ? getBylineField(collection) : 'author' - const author = bylineField ? str(rec[bylineField]) : '' + const author = roleValue(rec, collection && getBylineField(collection)) if (author && isArticle) out.author = { '@type': 'Person', name: author } if (options?.siteName && isArticle) { out.publisher = { '@type': 'Organization', name: options.siteName } @@ -268,64 +267,33 @@ function resolveCollection(col?: string | Collection): Collection | undefined { return col } +/** The value of a collection role on a document, or `''`. */ +function roleValue( + doc: Record<string, unknown>, + field: string | undefined, +): string { + return field ? str(doc[field]) : '' +} + function resolveDescription( doc: Record<string, unknown>, collection?: Collection, ): string { - if (collection?.summaryField) return str(doc[collection.summaryField]) - const summaryField = collection ? getSummaryField(collection) : undefined - if (summaryField) { - const val = str(doc[summaryField]) - if (val) return val - } - for (const key of ['excerpt', 'description', 'summary', 'subheading']) { - const val = str(doc[key]) - if (val) return val - } - if (Array.isArray(doc.blocks)) { - for (const b of doc.blocks) { - if (b && typeof b === 'object' && !Array.isArray(b)) { - const sub = str((b as Record<string, unknown>).subheading) - if (sub) return sub - } - } - } - return '' + return roleValue(doc, collection && getSummaryField(collection)) } function resolveImage( doc: Record<string, unknown>, collection?: Collection, ): string { - if (collection?.imageField) return str(doc[collection.imageField]) - if (collection) { - const imgField = getImageField(collection) - if (imgField) { - const val = str(doc[imgField]) - if (val) return val - } - } - for (const key of ['hero', 'image', 'coverImage', 'featuredImage', 'cover']) { - const val = str(doc[key]) - if (val) return val - } - if (Array.isArray(doc.blocks)) { - for (const b of doc.blocks) { - if (b && typeof b === 'object' && !Array.isArray(b)) { - const img = str((b as Record<string, unknown>).image) - if (img) return img - } - } - } - return '' + return roleValue(doc, collection && getImageField(collection)) } function resolveDate( doc: Record<string, unknown>, collection?: Collection, ): string { - if (collection?.dateField) return str(doc[collection.dateField]) - return str(doc.publishedDate) || str(doc.publishAt) || str(doc.date) + return roleValue(doc, collection && getDateField(collection)) } /** @@ -349,7 +317,7 @@ export function cmsHead<TDoc extends object = Doc>( const collection = resolveCollection(options?.collection) const seo = seoOverrides(rec) const titleField = collection?.titleField ?? 'title' - const rawDocTitle = rec ? str(rec[titleField]) || str(rec.title) : '' + const rawDocTitle = rec ? str(rec[titleField]) : '' const pageTitle = options?.title ?? seo.title ?? rawDocTitle const canonicalUrl = options?.canonicalUrl ?? seo.canonical const fullTitle = diff --git a/packages/core/src/lib/ui.ts b/packages/core/src/lib/ui.ts index d867f0fb..2a3d3479 100644 --- a/packages/core/src/lib/ui.ts +++ b/packages/core/src/lib/ui.ts @@ -418,36 +418,22 @@ export function renderBlockToHtml( switch (block._type) { case 'hero': { const image = str(block.image) - const heading = escapeHtml(str(block.heading || block.headline)) - const headingField = - block.headline !== undefined && block.heading === undefined - ? 'headline' - : 'heading' - const subheading = str(block.subheading || block.subheadline) - const subheadingField = - block.subheadline !== undefined && block.subheading === undefined - ? 'subheadline' - : 'subheading' + const heading = escapeHtml(str(block.heading)) + const subheading = str(block.subheading) const imgHtml = image ? `<img src="${escapeHtml(image)}" alt="" class="absolute inset-0 h-full w-full object-cover opacity-50" />` : '' const subHtml = subheading - ? `<p class="mt-2 text-lg opacity-85"${fieldAttr(subheadingField)}>${escapeHtml(subheading)}</p>` + ? `<p class="mt-2 text-lg opacity-85"${fieldAttr('subheading')}>${escapeHtml(subheading)}</p>` : '' - return `<section class="relative overflow-hidden" style="background: var(--cms-heading); color: var(--cms-bg); border-radius: var(--cms-radius)"${fieldAttr('image')}>${imgHtml}<div class="relative px-8 py-16"><h2 class="text-3xl font-bold"${fieldAttr(headingField)}>${heading}</h2>${subHtml}</div></section>` + return `<section class="relative overflow-hidden" style="background: var(--cms-heading); color: var(--cms-bg); border-radius: var(--cms-radius)"${fieldAttr('image')}>${imgHtml}<div class="relative px-8 py-16"><h2 class="text-3xl font-bold"${fieldAttr('heading')}>${heading}</h2>${subHtml}</div></section>` } case 'richText': { - const md = str(block.markdown || block.body) - const mdField = - block.body !== undefined && block.markdown === undefined - ? 'body' - : 'markdown' - return `<div class="prose-cms leading-relaxed"${fieldAttr(mdField)}>${renderMarkdownToHtml(md)}</div>` + const md = str(block.markdown) + return `<div class="prose-cms leading-relaxed"${fieldAttr('markdown')}>${renderMarkdownToHtml(md)}</div>` } case 'image': { - const src = str(block.src || block.image) - const srcField = - block.image !== undefined && block.src === undefined ? 'image' : 'src' + const src = str(block.image) const alt = str(block.alt) const caption = str(block.caption) const imgHtml = src @@ -456,21 +442,15 @@ export function renderBlockToHtml( const capHtml = caption ? `<figcaption class="text-center text-sm" style="color: var(--cms-muted)"${fieldAttr('caption')}>${escapeHtml(caption)}</figcaption>` : '' - return `<figure class="space-y-2"${fieldAttr(srcField)}>${imgHtml}${capHtml}</figure>` + return `<figure class="space-y-2"${fieldAttr('image')}>${imgHtml}${capHtml}</figure>` } case 'quote': { - const quote = str(block.quote || block.body) - const quoteField = - block.body !== undefined && block.quote === undefined ? 'body' : 'quote' - const attribution = str(block.attribution || block.author) - const attributionField = - block.author !== undefined && block.attribution === undefined - ? 'author' - : 'attribution' + const quote = str(block.quote) + const attribution = str(block.attribution) const attrHtml = attribution - ? `<cite class="mt-2 block text-xs not-italic" style="color: var(--cms-muted)"${fieldAttr(attributionField)}>— ${escapeHtml(attribution)}</cite>` + ? `<cite class="mt-2 block text-xs not-italic" style="color: var(--cms-muted)"${fieldAttr('attribution')}>— ${escapeHtml(attribution)}</cite>` : '' - return `<blockquote class="border-l-4 pl-4 italic" style="border-color: var(--cms-accent)"${fieldAttr(quoteField)}><p>${escapeHtml(quote)}</p>${attrHtml}</blockquote>` + return `<blockquote class="border-l-4 pl-4 italic" style="border-color: var(--cms-accent)"${fieldAttr('quote')}><p>${escapeHtml(quote)}</p>${attrHtml}</blockquote>` } case 'cta': { const label = escapeHtml(str(block.label) || 'Button') @@ -485,11 +465,11 @@ export function renderBlockToHtml( case 'callout': { const tone = str(block.tone) || 'info' const title = str(block.title) - const body = str(block.body) + const body = str(block.markdown) const titleHtml = title ? `<div class="mb-1 text-sm font-semibold"${fieldAttr('title')}>${escapeHtml(title)}</div>` : '' - return `<aside data-cms-callout="${escapeHtml(tone)}" class="border-l-4 px-5 py-4" style="border-radius: var(--cms-radius)"><div class="text-xs font-semibold uppercase tracking-wider opacity-70" style="margin-bottom: 0.25rem">${escapeHtml(tone)}</div>${titleHtml}<div class="prose-cms text-sm leading-relaxed"${fieldAttr('body')}>${renderMarkdownToHtml(body)}</div></aside>` + return `<aside data-cms-callout="${escapeHtml(tone)}" class="border-l-4 px-5 py-4" style="border-radius: var(--cms-radius)"><div class="text-xs font-semibold uppercase tracking-wider opacity-70" style="margin-bottom: 0.25rem">${escapeHtml(tone)}</div>${titleHtml}<div class="prose-cms text-sm leading-relaxed"${fieldAttr('markdown')}>${renderMarkdownToHtml(body)}</div></aside>` } case 'code': { const filename = str(block.filename) diff --git a/packages/core/src/schema.ts b/packages/core/src/schema.ts index 89451adc..5933cac6 100644 --- a/packages/core/src/schema.ts +++ b/packages/core/src/schema.ts @@ -454,25 +454,20 @@ export interface Collection<TDoc = Doc> { /** Optional field name used for the block array body (falls back to the first `blocks` field). */ blocksField?: string /** - * Featured image for cards, on-page editing, and the social/OpenGraph image - * (falls back to the first `image` field). When set, `cmsHead` reads only - * this field. + * Featured image for cards, on-page editing, and the social/OpenGraph image. + * Defaults to the first `image` field. */ imageField?: string - /** - * Short summary for cards and meta descriptions (falls back to `excerpt`, - * `description`, `summary`, or `subheading`). When set, `cmsHead` reads only - * this field. - */ + /** Short summary for cards, on-page editing, and meta descriptions. No default. */ summaryField?: string - /** Author name shown as a byline (falls back to a text field named `author`). */ + /** Author name shown as a byline and in JSON-LD. No default. */ bylineField?: string - /** Long-form body of flat documents (falls back to the first `markdown`, then `richtext`, field). */ - bodyField?: string /** - * Publication date for JSON-LD `datePublished`. When unset, `cmsJsonLd` - * tries `publishedDate`, the scheduled `publishAt`, then `date`. + * Long-form body of flat documents. Defaults to the first `markdown` or + * `richtext` field that isn't the summary. */ + bodyField?: string + /** Publication date for JSON-LD `datePublished`. No default. */ dateField?: string /** * Data migrations for this collection's documents, in ascending `version` @@ -704,30 +699,14 @@ export function getSlugField(collection: Collection): string | undefined { ) } -const SUMMARY_NAMES = ['excerpt', 'description', 'summary', 'subheading'] - -/** Return the short-summary field (excerpt / description), if one exists. */ +/** Return the declared short-summary field, if any. */ export function getSummaryField(collection: Collection): string | undefined { - if (collection.summaryField) return collection.summaryField - for (const name of SUMMARY_NAMES) { - const f = collection.fields.find((x) => x.name === name) - if ( - f && - (f.type === 'text' || f.type === 'textarea' || f.type === 'markdown') - ) { - return f.name - } - } - return undefined + return collection.summaryField } -/** Return the byline (author name) field, if one exists. */ +/** Return the declared byline (author name) field, if any. */ export function getBylineField(collection: Collection): string | undefined { - return ( - collection.bylineField ?? - collection.fields.find((f) => f.name === 'author' && f.type === 'text') - ?.name - ) + return collection.bylineField } /** Default name of the built-in asset collection (`defineCms({ assets })` overrides). */ @@ -759,17 +738,17 @@ export function isRelationField(field: Field): boolean { } /** - * Return the long-form body field of a flat (non-block) document: the first - * `markdown` field, else the first `richtext` field. + * Return the long-form body field of a flat (non-block) document: the + * declared `bodyField`, else the first `markdown` or `richtext` field that + * isn't the summary. */ export function getBodyField(collection: Collection): string | undefined { if (collection.bodyField) return collection.bodyField - const summary = getSummaryField(collection) - const candidates = collection.fields.filter((f) => f.name !== summary) - return ( - candidates.find((f) => f.type === 'markdown')?.name ?? - candidates.find((f) => f.type === 'richtext')?.name - ) + return collection.fields.find( + (f) => + (f.type === 'markdown' || f.type === 'richtext') && + f.name !== collection.summaryField, + )?.name } /** Return the declared publication-date field, if any. */ @@ -792,6 +771,9 @@ export interface CollectionRoles { /** * Resolve every content role of a collection: what cards, on-page editing, * and `cmsHead` read for its title, image, summary, byline, body, and date. + * Roles are the declared fields, plus one rule each for slug (a field named + * `slug`), blocks (the first `blocks` field), image (the first `image` + * field), and body (see {@link getBodyField}). */ export function getCollectionRoles(collection: Collection): CollectionRoles { return { diff --git a/packages/core/tests/schema.test.ts b/packages/core/tests/schema.test.ts index e19389cc..15f2cb34 100644 --- a/packages/core/tests/schema.test.ts +++ b/packages/core/tests/schema.test.ts @@ -21,6 +21,8 @@ import { getSummaryField, getBylineField, getBodyField, + getCollectionRoles, + getDateField, isArticleSchemaType, getTheme, normalizeBlocks, @@ -446,7 +448,7 @@ describe('schema and config', () => { expect(getSlugField(minimalCol)).toBeUndefined() }) - it('resolves summary, byline, and body fields by role', () => { + it('resolves summary, byline, body, and date fields by role', () => { const article = { name: 'article', label: 'Articles', @@ -463,16 +465,35 @@ describe('schema and config', () => { { name: 'notes', label: 'Notes', type: 'markdown' as const }, ], } - expect(getSummaryField(article)).toBe('description') - expect(getBylineField(article)).toBe('author') + // no name-based guesses: summary and byline must be declared + expect(getSummaryField(article)).toBeUndefined() + expect(getBylineField(article)).toBeUndefined() + expect(getDateField(article)).toBeUndefined() + // body: the first markdown or richtext field + expect(getBodyField(article)).toBe('description') + + const declared = { + ...article, + summaryField: 'description', + bylineField: 'author', + dateField: 'published', + } + expect(getSummaryField(declared)).toBe('description') + expect(getBylineField(declared)).toBe('author') + expect(getDateField(declared)).toBe('published') // the summary is never also the body - expect(getBodyField(article)).toBe('notes') - expect( - getBodyField({ ...article, fields: article.fields.slice(0, 4) }), - ).toBe('content') - expect(getBodyField({ ...article, bodyField: 'content' })).toBe('content') - expect(getSummaryField({ ...article, summaryField: 'notes' })).toBe('notes') - expect(getBylineField({ ...article, fields: [] })).toBeUndefined() + expect(getBodyField(declared)).toBe('content') + expect(getBodyField({ ...declared, bodyField: 'notes' })).toBe('notes') + expect(getCollectionRoles(declared)).toEqual({ + title: 'title', + slug: undefined, + blocks: undefined, + image: undefined, + summary: 'description', + byline: 'author', + body: 'content', + date: 'published', + }) expect(isArticleSchemaType('BlogPosting')).toBe(true) expect(isArticleSchemaType('NewsArticle')).toBe(true) expect(isArticleSchemaType('WebPage')).toBe(false) @@ -494,6 +515,7 @@ describe('schema and config', () => { label: 'Posts', titleField: 'headline', imageField: 'coverImage', + summaryField: 'excerpt', schemaType: 'BlogPosting', fields: [ { name: 'headline', label: 'Headline', type: 'text' }, @@ -577,7 +599,8 @@ describe('schema and config', () => { { rel: 'canonical', href: 'https://example.com/blog/launching' }, ]) - // Draft document gets noindex, nofollow by default and falls back to block subheading/image + // A draft gets noindex, nofollow by default; without a collection there + // are no roles, so blocks don't stand in for the description or image const draftPage = { title: 'Draft Page', published: false, @@ -595,14 +618,8 @@ describe('schema and config', () => { name: 'robots', content: 'noindex, nofollow', }) - expect(headDraft.meta).toContainEqual({ - name: 'description', - content: 'Derived from hero block', - }) - expect(headDraft.meta).toContainEqual({ - property: 'og:image', - content: '/api/media/block-img', - }) + expect(headDraft.meta.some((m) => m.name === 'description')).toBe(false) + expect(headDraft.meta.some((m) => m.property === 'og:image')).toBe(false) }) }) diff --git a/packages/core/tests/seo.test.ts b/packages/core/tests/seo.test.ts index 131518f3..22647ee7 100644 --- a/packages/core/tests/seo.test.ts +++ b/packages/core/tests/seo.test.ts @@ -34,12 +34,16 @@ const post: Collection = { name: 'post', label: 'Posts', titleField: 'title', + summaryField: 'excerpt', + bylineField: 'author', + dateField: 'publishedDate', schemaType: 'BlogPosting', path: (_doc, id) => `/post/${id}`, fields: [ { name: 'title', label: 'Title', type: 'text' }, { name: 'excerpt', label: 'Excerpt', type: 'textarea' }, { name: 'author', label: 'Author', type: 'text' }, + { name: 'publishedDate', label: 'Published', type: 'date' }, { name: 'cover', label: 'Cover', type: 'image' }, seoField(), ], @@ -113,6 +117,52 @@ describe('cmsHead', () => { }) }) + it('reads the description, image, date, and author from the roles only', () => { + setup() + const doc = { + title: 'Post', + excerpt: 'Excerpt', + author: 'Ada', + publishedDate: '2026-01-15', + cover: '/c.png', + description: 'Not the summary', + hero: '/not-the-image.png', + date: '2020-01-01', + blocks: [{ _type: 'hero', subheading: 'Sub', image: '/b.png' }], + published: true, + } + expect(cmsJsonLd(doc, { collection: 'post' })).toMatchObject({ + description: 'Excerpt', + image: '/c.png', + datePublished: '2026-01-15', + author: { '@type': 'Person', name: 'Ada' }, + }) + + const bare: Collection = { + name: 'note', + label: 'Notes', + titleField: 'title', + schemaType: 'BlogPosting', + fields: [ + { name: 'title', label: 'Title', type: 'text' }, + { name: 'excerpt', label: 'Excerpt', type: 'textarea' }, + { name: 'author', label: 'Author', type: 'text' }, + { name: 'hero', label: 'Hero', type: 'url' }, + { name: 'publishedDate', label: 'Published', type: 'date' }, + ], + } + const ld = cmsJsonLd(doc, { collection: bare }) + expect(ld).not.toHaveProperty('description') + expect(ld).not.toHaveProperty('image') + expect(ld).not.toHaveProperty('datePublished') + expect(ld).not.toHaveProperty('author') + expect( + cmsHead(doc, { collection: bare }).meta.some( + (m) => m.name === 'description' || m.property === 'og:image', + ), + ).toBe(false) + }) + it('cmsJsonLd uses WebPage for other collections', () => { setup() expect( diff --git a/packages/core/tests/ui.test.ts b/packages/core/tests/ui.test.ts index b28f5438..3ecae272 100644 --- a/packages/core/tests/ui.test.ts +++ b/packages/core/tests/ui.test.ts @@ -177,11 +177,11 @@ describe('block rendering', () => { { _type: 'hero', heading: 'Hi', subheading: 'There', image: '/i.png' }, { _type: 'hero', heading: 'Bare' }, { _type: 'richText', markdown: '**x**' }, - { _type: 'image', src: '/a.png', alt: 'A', caption: 'Cap' }, + { _type: 'image', image: '/a.png', alt: 'A', caption: 'Cap' }, { _type: 'image' }, { _type: 'cta', label: 'Go', href: '/go', variant: 'secondary' }, { _type: 'cta', href: 'javascript:x' }, - { _type: 'callout', tone: 'warn', title: 'T', body: 'B' }, + { _type: 'callout', tone: 'warn', title: 'T', markdown: 'B' }, { _type: 'callout' }, { _type: 'code', filename: 'a.ts', language: 'ts', code: '<x>' }, { _type: 'code', code: 'y' }, @@ -196,12 +196,14 @@ describe('block rendering', () => { expect(html[0]).toContain('There') expect(html[1]).not.toContain('<img') expect(html[2]).toContain('<strong>x</strong>') + expect(html[3]).toContain('<img src="/a.png" alt="A"') expect(html[3]).toContain('<figcaption') expect(html[4]).toContain('(no image)') expect(html[5]).toContain('border: 1px solid') expect(html[6]).toContain('href="#"') expect(html[6]).toContain('>Button</a>') expect(html[7]).toContain('data-cms-callout="warn"') + expect(html[7]).toContain('<p>B</p>') expect(html[8]).toContain('data-cms-callout="info"') expect(html[9]).toContain('<x>') expect(html[9]).toContain('a.ts') @@ -225,20 +227,24 @@ describe('block rendering', () => { attribution: 'Will', }), ).toContain('data-cms-field="attribution"') - expect( - renderBlockToHtml({ - _type: 'quote', - body: 'Aliased', - author: 'Ada', - }), - ).toContain('data-cms-field="body"') - expect( - renderBlockToHtml({ - _type: 'quote', - body: 'Aliased', - author: 'Ada', - }), - ).toContain('data-cms-field="author"') + }) + + it('reads one field name per built-in block field', () => { + const blocks: Array<Block> = [ + { _type: 'hero', headline: 'H', subheadline: 'S' }, + { _type: 'richText', body: 'B' }, + { _type: 'image', src: '/a.png' }, + { _type: 'quote', body: 'Q', author: 'Ada' }, + { _type: 'callout', body: 'C' }, + ] + const html = blocks.map((b) => renderBlockToHtml(b)) + expect(html[0]).not.toContain('>H<') + expect(html[0]).not.toContain('>S<') + expect(html[1]).not.toContain('B') + expect(html[2]).toContain('(no image)') + expect(html[3]).not.toContain('Q') + expect(html[3]).not.toContain('Ada') + expect(html[4]).not.toContain('<p>C</p>') }) it('renders registered block types field by field, and unknown ones as JSON', () => { diff --git a/packages/ui-dom/tests/ui-dom.test.ts b/packages/ui-dom/tests/ui-dom.test.ts index 4d4c951c..2afb3856 100644 --- a/packages/ui-dom/tests/ui-dom.test.ts +++ b/packages/ui-dom/tests/ui-dom.test.ts @@ -246,7 +246,7 @@ describe('@tanstack/cms-ui-dom', () => { { _type: 'richText', markdown: 'Hello **Svelte**' }, { _type: 'image', - src: '/api/media/pic.jpg', + image: '/api/media/pic.jpg', alt: 'Alt text', caption: 'A caption', }, @@ -260,7 +260,7 @@ describe('@tanstack/cms-ui-dom', () => { _type: 'callout', tone: 'info', title: 'Note', - body: 'Read carefully', + markdown: 'Read carefully', }, { _type: 'code', @@ -294,7 +294,9 @@ describe('@tanstack/cms-ui-dom', () => { expect(html).toContain('Hello <strong>Svelte</strong>') expect(html).toContain('A caption') expect(html).toContain('Get Started') + expect(html).toContain('src="/api/media/pic.jpg"') expect(html).toContain('data-cms-callout="info"') + expect(html).toContain('Read carefully') expect(html).toContain('app.svelte') expect(html).toContain('Left <strong>col</strong>') expect(html).toContain('https://example.com/embed') diff --git a/packages/ui-react/src/components/blocks-view.tsx b/packages/ui-react/src/components/blocks-view.tsx index ca5424a4..51c58590 100644 --- a/packages/ui-react/src/components/blocks-view.tsx +++ b/packages/ui-react/src/components/blocks-view.tsx @@ -298,7 +298,7 @@ function CalloutBlock({ }) { const tone = str(block.tone) || 'note' const title = str(block.title) - const md = str(block.markdown) || str(block.body) + const md = str(block.markdown) return ( <aside className="border-l-4 px-5 py-4" diff --git a/packages/ui-react/src/components/on-page/post-content.tsx b/packages/ui-react/src/components/on-page/post-content.tsx index 68468af0..1e8d11dd 100644 --- a/packages/ui-react/src/components/on-page/post-content.tsx +++ b/packages/ui-react/src/components/on-page/post-content.tsx @@ -2,7 +2,7 @@ * On-page editing for flat (non-block) documents: per-field selection, inline * edits, markdown body, AI. The fields come from the collection: its * `titleField`, `bylineField`, `summaryField`, `imageField`, and `bodyField` - * roles (each with a conventional fallback, see `getCollectionRoles`). + * roles (see `getCollectionRoles`). */ import { useEffect, useState } from 'react' import { Link, useRouter } from '@tanstack/react-router' @@ -41,15 +41,7 @@ interface PostRoles { } function postRoles(collection: Collection | undefined): PostRoles { - if (!collection) { - return { - title: 'title', - byline: 'author', - summary: 'excerpt', - image: 'hero', - body: 'body', - } - } + if (!collection) return { title: 'title' } const { title, byline, summary, image, body } = getCollectionRoles(collection) return { title, byline, summary, image, body } } diff --git a/scripts/codemods/explicit-roles.ts b/scripts/codemods/explicit-roles.ts index f0dc793f..e087ffd0 100644 --- a/scripts/codemods/explicit-roles.ts +++ b/scripts/codemods/explicit-roles.ts @@ -1,7 +1,7 @@ /** * Declare a collection's content roles (`imageField`, `summaryField`, * `bylineField`, `bodyField`, `dateField`) explicitly, set to the field the - * name-based fallbacks pick today: + * name-based fallbacks removed from `@tanstack/cms-core` used to pick: * * - image: the first `image` field, else the first of `hero`, `image`, * `coverImage`, `featuredImage`, `cover` (a `url` or `text` field); @@ -115,7 +115,7 @@ function readFields(array: ArrayLiteralExpression): { return { fields, unreadable } } -/** The field each undeclared role resolves to under today's fallbacks. */ +/** The field each undeclared role resolved to under the removed fallbacks. */ function inferRoles( fields: ReadonlyArray<FieldInfo>, declared: Partial<Record<Role, string>>, @@ -194,7 +194,7 @@ function rewrite( export const explicitRoles: Codemod = { name: 'explicit-roles', description: - 'Declare collection roles (imageField, summaryField, bylineField, bodyField, dateField) that the name-based fallbacks pick today', + 'Declare collection roles (imageField, summaryField, bylineField, bodyField, dateField) that the removed name-based fallbacks used to pick', mightApply: (text) => text.includes('titleField'), transform(file: SourceFile, ctx: CodemodContext) { const edits: Array<TextEdit> = [] diff --git a/scripts/dialect-inventory.baseline.json b/scripts/dialect-inventory.baseline.json index df9fecea..f5ac7e6f 100644 --- a/scripts/dialect-inventory.baseline.json +++ b/scripts/dialect-inventory.baseline.json @@ -82,7 +82,7 @@ "test": 2 }, "seoCascadeFields": { - "nonTest": 9, + "nonTest": 0, "test": 0 } } diff --git a/scripts/seo-snapshots/__snapshots__/examples__astro-starlight-after.json b/scripts/seo-snapshots/__snapshots__/examples__astro-starlight-after.json index f4f7fd5a..0b7c8ffc 100644 --- a/scripts/seo-snapshots/__snapshots__/examples__astro-starlight-after.json +++ b/scripts/seo-snapshots/__snapshots__/examples__astro-starlight-after.json @@ -15,9 +15,7 @@ "og:type": "website", "og:site_name": "Acme Docs", "og:description": "Description text", - "og:image": "/api/media/hero-block.png", - "twitter:card": "summary_large_image", - "twitter:image": "/api/media/hero-block.png", + "twitter:card": "summary", "twitter:title": "Title text", "twitter:description": "Description text" }, @@ -27,7 +25,6 @@ "@type": "WebPage", "name": "Title text", "description": "Description text", - "image": "/api/media/hero-block.png", "dateModified": "2026-02-01T00:00:00.000Z" } ] diff --git a/scripts/seo-snapshots/__snapshots__/examples__blog-voting.json b/scripts/seo-snapshots/__snapshots__/examples__blog-voting.json index 9f9ac07b..67d3ab42 100644 --- a/scripts/seo-snapshots/__snapshots__/examples__blog-voting.json +++ b/scripts/seo-snapshots/__snapshots__/examples__blog-voting.json @@ -10,23 +10,19 @@ "(generated)": { "meta": { "title": "Title text · TanStack CMS", - "description": "Hero subheading", "og:title": "Title text", "og:type": "website", "og:site_name": "TanStack CMS", - "og:description": "Hero subheading", "og:image": "/api/media/hero.png", "twitter:card": "summary_large_image", "twitter:image": "/api/media/hero.png", - "twitter:title": "Title text", - "twitter:description": "Hero subheading" + "twitter:title": "Title text" }, "jsonLd": [ { "@context": "https://schema.org", "@type": "WebPage", "name": "Title text", - "description": "Hero subheading", "image": "/api/media/hero.png", "dateModified": "2026-02-01T00:00:00.000Z" } @@ -35,21 +31,17 @@ "home": { "meta": { "title": "Welcome · TanStack CMS", - "description": "Edit this page — or ask the agent to.", "og:title": "Welcome", "og:type": "website", "og:site_name": "TanStack CMS", - "og:description": "Edit this page — or ask the agent to.", "twitter:card": "summary", - "twitter:title": "Welcome", - "twitter:description": "Edit this page — or ask the agent to." + "twitter:title": "Welcome" }, "jsonLd": [ { "@context": "https://schema.org", "@type": "WebPage", - "name": "Welcome", - "description": "Edit this page — or ask the agent to." + "name": "Welcome" } ] }, diff --git a/scripts/seo-snapshots/__snapshots__/examples__blog.json b/scripts/seo-snapshots/__snapshots__/examples__blog.json index 9f9ac07b..67d3ab42 100644 --- a/scripts/seo-snapshots/__snapshots__/examples__blog.json +++ b/scripts/seo-snapshots/__snapshots__/examples__blog.json @@ -10,23 +10,19 @@ "(generated)": { "meta": { "title": "Title text · TanStack CMS", - "description": "Hero subheading", "og:title": "Title text", "og:type": "website", "og:site_name": "TanStack CMS", - "og:description": "Hero subheading", "og:image": "/api/media/hero.png", "twitter:card": "summary_large_image", "twitter:image": "/api/media/hero.png", - "twitter:title": "Title text", - "twitter:description": "Hero subheading" + "twitter:title": "Title text" }, "jsonLd": [ { "@context": "https://schema.org", "@type": "WebPage", "name": "Title text", - "description": "Hero subheading", "image": "/api/media/hero.png", "dateModified": "2026-02-01T00:00:00.000Z" } @@ -35,21 +31,17 @@ "home": { "meta": { "title": "Welcome · TanStack CMS", - "description": "Edit this page — or ask the agent to.", "og:title": "Welcome", "og:type": "website", "og:site_name": "TanStack CMS", - "og:description": "Edit this page — or ask the agent to.", "twitter:card": "summary", - "twitter:title": "Welcome", - "twitter:description": "Edit this page — or ask the agent to." + "twitter:title": "Welcome" }, "jsonLd": [ { "@context": "https://schema.org", "@type": "WebPage", - "name": "Welcome", - "description": "Edit this page — or ask the agent to." + "name": "Welcome" } ] }, diff --git a/scripts/seo-snapshots/__snapshots__/examples__emdash-after.json b/scripts/seo-snapshots/__snapshots__/examples__emdash-after.json index cf5f1797..220b53b9 100644 --- a/scripts/seo-snapshots/__snapshots__/examples__emdash-after.json +++ b/scripts/seo-snapshots/__snapshots__/examples__emdash-after.json @@ -9,24 +9,17 @@ "(generated)": { "meta": { "title": "Title text · My Blog", - "description": "Hero subheading", "og:title": "Title text", "og:type": "website", "og:site_name": "My Blog", - "og:description": "Hero subheading", - "og:image": "/api/media/hero-block.png", - "twitter:card": "summary_large_image", - "twitter:image": "/api/media/hero-block.png", - "twitter:title": "Title text", - "twitter:description": "Hero subheading" + "twitter:card": "summary", + "twitter:title": "Title text" }, "jsonLd": [ { "@context": "https://schema.org", "@type": "WebPage", "name": "Title text", - "description": "Hero subheading", - "image": "/api/media/hero-block.png", "dateModified": "2026-02-01T00:00:00.000Z" } ] diff --git a/scripts/seo-snapshots/__snapshots__/examples__payload-after.json b/scripts/seo-snapshots/__snapshots__/examples__payload-after.json index 215e1cbc..ca461bbb 100644 --- a/scripts/seo-snapshots/__snapshots__/examples__payload-after.json +++ b/scripts/seo-snapshots/__snapshots__/examples__payload-after.json @@ -10,23 +10,19 @@ "(generated)": { "meta": { "title": "Title text · Payload Showcase", - "description": "Hero subheading", "og:title": "Title text", "og:type": "website", "og:site_name": "Payload Showcase", - "og:description": "Hero subheading", "og:image": "/api/media/hero.png", "twitter:card": "summary_large_image", "twitter:image": "/api/media/hero.png", - "twitter:title": "Title text", - "twitter:description": "Hero subheading" + "twitter:title": "Title text" }, "jsonLd": [ { "@context": "https://schema.org", "@type": "WebPage", "name": "Title text", - "description": "Hero subheading", "image": "/api/media/hero.png", "dateModified": "2026-02-01T00:00:00.000Z" } @@ -53,21 +49,17 @@ "home": { "meta": { "title": "Welcome · Payload Showcase", - "description": "Edit this page — or ask the agent to.", "og:title": "Welcome", "og:type": "website", "og:site_name": "Payload Showcase", - "og:description": "Edit this page — or ask the agent to.", "twitter:card": "summary", - "twitter:title": "Welcome", - "twitter:description": "Edit this page — or ask the agent to." + "twitter:title": "Welcome" }, "jsonLd": [ { "@context": "https://schema.org", "@type": "WebPage", - "name": "Welcome", - "description": "Edit this page — or ask the agent to." + "name": "Welcome" } ] } diff --git a/scripts/seo-snapshots/__snapshots__/examples__wordpress-after.json b/scripts/seo-snapshots/__snapshots__/examples__wordpress-after.json index bcbef516..6b3f2598 100644 --- a/scripts/seo-snapshots/__snapshots__/examples__wordpress-after.json +++ b/scripts/seo-snapshots/__snapshots__/examples__wordpress-after.json @@ -9,24 +9,17 @@ "(generated)": { "meta": { "title": "Title text · The Garden Path", - "description": "Hero subheading", "og:title": "Title text", "og:type": "website", "og:site_name": "The Garden Path", - "og:description": "Hero subheading", - "og:image": "/api/media/hero-block.png", - "twitter:card": "summary_large_image", - "twitter:image": "/api/media/hero-block.png", - "twitter:title": "Title text", - "twitter:description": "Hero subheading" + "twitter:card": "summary", + "twitter:title": "Title text" }, "jsonLd": [ { "@context": "https://schema.org", "@type": "WebPage", "name": "Title text", - "description": "Hero subheading", - "image": "/api/media/hero-block.png", "dateModified": "2026-02-01T00:00:00.000Z" } ] diff --git a/scripts/seo-snapshots/__snapshots__/starters__themed-smb-site.json b/scripts/seo-snapshots/__snapshots__/starters__themed-smb-site.json index 6e2b9575..22647294 100644 --- a/scripts/seo-snapshots/__snapshots__/starters__themed-smb-site.json +++ b/scripts/seo-snapshots/__snapshots__/starters__themed-smb-site.json @@ -9,24 +9,17 @@ "(generated)": { "meta": { "title": "Page Title text · TanStack CMS", - "description": "Hero subheading", "og:title": "Page Title text", "og:type": "website", "og:site_name": "TanStack CMS", - "og:description": "Hero subheading", - "og:image": "/api/media/hero-block.png", - "twitter:card": "summary_large_image", - "twitter:image": "/api/media/hero-block.png", - "twitter:title": "Page Title text", - "twitter:description": "Hero subheading" + "twitter:card": "summary", + "twitter:title": "Page Title text" }, "jsonLd": [ { "@context": "https://schema.org", "@type": "WebPage", "name": "Page Title text", - "description": "Hero subheading", - "image": "/api/media/hero-block.png", "dateModified": "2026-02-01T00:00:00.000Z" } ]