feat(seo): getSeoMeta accepts defaultTitle/defaultDescription (#1518)#1957
feat(seo): getSeoMeta accepts defaultTitle/defaultDescription (#1518)#1957swissky wants to merge 1 commit into
Conversation
…-cms#1518) Pages with computed titles/descriptions had to drop down to getContentSeo and merge panel-vs-default by hand, because getSeoMeta's only fallbacks were data.title/data.excerpt. The new options rank between the SEO panel value and the data fallback, so editor-set panel values still win.
🦋 Changeset detectedLatest commit: 54caa74 The changes in this PR will be included in the next version bump. This PR includes changesets to release 16 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
@emdash-cms/admin
@emdash-cms/auth
@emdash-cms/auth-atproto
@emdash-cms/blocks
@emdash-cms/cloudflare
@emdash-cms/contentful-to-portable-text
emdash
create-emdash
@emdash-cms/gutenberg-to-portable-text
@emdash-cms/plugin-cli
@emdash-cms/plugin-types
@emdash-cms/registry-client
@emdash-cms/registry-lexicons
@emdash-cms/sandbox-workerd
@emdash-cms/x402
@emdash-cms/plugin-ai-moderation
@emdash-cms/plugin-atproto
@emdash-cms/plugin-audit-log
@emdash-cms/plugin-color
@emdash-cms/plugin-embeds
@emdash-cms/plugin-field-kit
@emdash-cms/plugin-forms
@emdash-cms/plugin-webhook-notifier
commit: |
There was a problem hiding this comment.
This is the right change, implemented in the right place. getSeoMeta is the helper callers already reach for, and adding defaultTitle/defaultDescription as an extra rung in the existing fallback ladder solves the computed-title use case without making anyone drop down to getContentSeo or hand-roll <title>. It is purely additive: the return type is unchanged, the new options are optional, and the precedence (panel value → caller default → content field) matches the PR description exactly.
I checked the helper implementation, the new unit tests, the changeset, and package exports. The precedence chain is correct, siteTitle suffix behavior is preserved, and the fallback to data.title/data.excerpt is unchanged when no defaults are supplied. The changeset is user-facing, present tense, and identifies the migration story. No AGENTS.md conventions are violated: there is no new user-facing UI text, no SQL, no auth/locale/database changes, and a changeset is included.
No issues found.
What does this PR do?
Implements suggestion 2 from #1518 (milestone 1.0):
getSeoMetanow acceptsdefaultTitleanddefaultDescriptionoptions.Design discussion: #1956
Today the helper's only fallbacks are
data.title/data.excerpt. A page with a computed title (the issue's example:"Maeta — {title} (cover of {artist})") can't usegetSeoMetaat all — the author has to drop down togetContentSeoand merge panel-vs-default by hand, or (worse, and this is the footgun) hand-roll<title>and silently bypass the whole SEO panel including thenoindextoggle.The new options slot in between the panel value and the data fallback:
defaultTitle>data.titledefaultDescription>data.excerptEditor-set panel values always win, so the panel stays authoritative. Purely additive; existing callers are unaffected. The
siteTitlesuffix applies to a default title like any other page title.Complements the docs fixes for suggestion 1 (#1519 by the reporter, #1900) by removing the main remaining reason to hand-roll
<title>in the first place. Suggestion 3 (dev-mode warning) is intentionally out of scope — it needs render-path tracking and is better evaluated once docs + this helper have landed.Refs #1518
Type of change
How was this change tested?
tests/unit/seo/get-seo-meta.test.ts: defaults beatdata.title/data.excerpt, panel values beat defaults, behavior without defaults is unchanged,siteTitlesuffix applies to the default titletests/integration/seo/seo.test.tsstill passes (67 tests total across both files)pnpm typecheck,pnpm lint,pnpm formatall cleanChecklist
pnpm changeset) if this change affects published packagesAI-generated code disclosure
Which tool? Cursor (Fable 5)