Skip to content

docs: document rendering SEO panel data via getSeoMeta (#1518)#1900

Open
swissky wants to merge 2 commits into
emdash-cms:mainfrom
swissky:docs/seo-panel-wiring
Open

docs: document rendering SEO panel data via getSeoMeta (#1518)#1900
swissky wants to merge 2 commits into
emdash-cms:mainfrom
swissky:docs/seo-panel-wiring

Conversation

@swissky

@swissky swissky commented Jul 9, 2026

Copy link
Copy Markdown
Contributor

What does this PR do?

Addresses the documentation half of #1518. The SEO panel's data has been reachable on the render path since #1285 (entry.data.seo), but getSeoMeta / getContentSeo were documented nowhere in the public docs — only in the in-repo agent skill references. So the footgun in #1518 stands: a template that hand-rolls <title>/<meta> from data.title silently bypasses the entire panel, including the noindex toggle.

This adds a "Rendering SEO Panel Data" section to the Querying Content guide with a complete getSeoMeta example (title/description/OG image/canonical/robots) and a caution box calling out that every detail-page template for an SEO-enabled collection must render through it.

It deliberately does not attempt the "warn the editor in the admin when the template doesn't consume SEO" idea from the issue — detecting template wiring from the server is a design discussion, not a docs fix.

Type of change

  • Documentation update

Checklist

  • I have read CONTRIBUTING.md
  • pnpm typecheck passes
  • pnpm lint passes
  • pnpm test passes (or targeted tests for my change) — docs only
  • pnpm format has been run
  • I have added/updated tests for my changes (if applicable) — n/a, docs
  • User-visible strings in the admin UI are wrapped for translation (if applicable) — n/a
  • I have added a changeset (if this PR changes a published package) — n/a, docs
  • New features link to an approved Discussion — n/a

AI-generated code disclosure

  • This PR includes AI-generated code — model/tool: Cursor + Claude (Fable 5)

Screenshots / test output

n/a — docs. Example verified against the actual SeoMetaOptions / SeoMeta shapes in packages/core/src/seo/index.ts.

getSeoMeta/getContentSeo were undocumented outside the in-repo skill
references, so templates that hand-roll meta tags silently bypass the
whole SEO panel, including the noindex toggle. Adds a section to the
querying guide with a full example and a caution about the footgun.
@changeset-bot

changeset-bot Bot commented Jul 9, 2026

Copy link
Copy Markdown

⚠️ No Changeset found

Latest commit: 9db9183

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@pkg-pr-new

pkg-pr-new Bot commented Jul 9, 2026

Copy link
Copy Markdown

Open in StackBlitz

@emdash-cms/admin

npm i https://pkg.pr.new/@emdash-cms/admin@1900

@emdash-cms/auth

npm i https://pkg.pr.new/@emdash-cms/auth@1900

@emdash-cms/auth-atproto

npm i https://pkg.pr.new/@emdash-cms/auth-atproto@1900

@emdash-cms/blocks

npm i https://pkg.pr.new/@emdash-cms/blocks@1900

@emdash-cms/cloudflare

npm i https://pkg.pr.new/@emdash-cms/cloudflare@1900

@emdash-cms/contentful-to-portable-text

npm i https://pkg.pr.new/@emdash-cms/contentful-to-portable-text@1900

emdash

npm i https://pkg.pr.new/emdash@1900

create-emdash

npm i https://pkg.pr.new/create-emdash@1900

@emdash-cms/gutenberg-to-portable-text

npm i https://pkg.pr.new/@emdash-cms/gutenberg-to-portable-text@1900

@emdash-cms/plugin-cli

npm i https://pkg.pr.new/@emdash-cms/plugin-cli@1900

@emdash-cms/plugin-types

npm i https://pkg.pr.new/@emdash-cms/plugin-types@1900

@emdash-cms/registry-client

npm i https://pkg.pr.new/@emdash-cms/registry-client@1900

@emdash-cms/registry-lexicons

npm i https://pkg.pr.new/@emdash-cms/registry-lexicons@1900

@emdash-cms/sandbox-workerd

npm i https://pkg.pr.new/@emdash-cms/sandbox-workerd@1900

@emdash-cms/x402

npm i https://pkg.pr.new/@emdash-cms/x402@1900

@emdash-cms/plugin-ai-moderation

npm i https://pkg.pr.new/@emdash-cms/plugin-ai-moderation@1900

@emdash-cms/plugin-atproto

npm i https://pkg.pr.new/@emdash-cms/plugin-atproto@1900

@emdash-cms/plugin-audit-log

npm i https://pkg.pr.new/@emdash-cms/plugin-audit-log@1900

@emdash-cms/plugin-color

npm i https://pkg.pr.new/@emdash-cms/plugin-color@1900

@emdash-cms/plugin-embeds

npm i https://pkg.pr.new/@emdash-cms/plugin-embeds@1900

@emdash-cms/plugin-field-kit

npm i https://pkg.pr.new/@emdash-cms/plugin-field-kit@1900

@emdash-cms/plugin-forms

npm i https://pkg.pr.new/@emdash-cms/plugin-forms@1900

@emdash-cms/plugin-webhook-notifier

npm i https://pkg.pr.new/@emdash-cms/plugin-webhook-notifier@1900

commit: 9db9183

@emdashbot emdashbot Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The PR does the right thing: the SEO panel data has been reachable since #1285 but the public docs never showed how to render it, so this fills a real gap. The documented API shapes match packages/core/src/seo/index.ts (getSeoMeta is re-exported from the main "emdash" entry, SeoMeta fields line up, and entry.data.seo is where the loader attaches the folded SEO data).

I checked the diff, the SEO implementation, the loader's extractSeo/entryData.seo wiring, the package exports, and the generated types. The docs are mostly clean.

One inconsistency: the new example drops the error check that the same guide demonstrates in the preceding "Get a Single Entry" section and its "Error Handling" subsection. Treating a query failure the same as a missing entry is an anti-pattern to avoid teaching readers.

Recommended fix: make the SEO example mirror the error-handling pattern used earlier in the page.

---
import { getEmDashEntry, getSeoMeta } from "emdash";

const { entry } = await getEmDashEntry("posts", Astro.params.slug);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[suggestion] The example ignores the error result from getEmDashEntry and redirects any failure to /404. The "Get a Single Entry" section immediately above this addition demonstrates checking error first, and the guide's "Error Handling" subsection recommends it. For consistency and to avoid teaching readers to swallow query failures, mirror that pattern here:

Suggested change
const { entry } = await getEmDashEntry("posts", Astro.params.slug);
const { entry, error } = await getEmDashEntry("posts", Astro.params.slug);
if (error) {
return new Response("Server error", { status: 500 });
}
if (!entry) return Astro.redirect("/404");

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in 9db9183 — the example now destructures error, returns a 500 on query failure, and only redirects to /404 for a genuinely missing entry, matching the "Get a Single Entry" pattern above.

@github-actions github-actions Bot added review/awaiting-author Reviewed; waiting on the author to respond and removed review/needs-review No maintainer or bot review yet labels Jul 10, 2026
@github-actions github-actions Bot added review/needs-rereview Author pushed changes since the last review and removed review/awaiting-author Reviewed; waiting on the author to respond labels Jul 10, 2026
@swissky swissky added the bot:review Trigger an emdashbot code review on this PR label Jul 10, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/docs bot:review Trigger an emdashbot code review on this PR review/needs-rereview Author pushed changes since the last review size/S

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant