Skip to content

fix(plugins): expose slug and status on ContentItem#460

Open
all3f0r1 wants to merge 1 commit intoemdash-cms:mainfrom
all3f0r1:fix/plugin-content-item-slug-373
Open

fix(plugins): expose slug and status on ContentItem#460
all3f0r1 wants to merge 1 commit intoemdash-cms:mainfrom
all3f0r1:fix/plugin-content-item-slug-373

Conversation

@all3f0r1
Copy link
Copy Markdown
Contributor

@all3f0r1 all3f0r1 commented Apr 11, 2026

What does this PR do?

The plugin content API (ctx.content.get() / ctx.content.list()) returned ContentItem without the slug or status fields, even though the underlying row has both and the REST API already surfaces them at the top level. This made it surprisingly painful to match external data to EmDash content by slug — migration plugins, SEO plugins, and WXR importers had to fall back to fragile title matching.

This PR adds slug (nullable — a freshly created draft may not have one yet) and status to ContentItem, and populates them in both the read-only and read/write content access adapters in packages/core/src/plugins/context.ts. The data was already on the repository-level ContentItem; the plugin adapter was just dropping it on the floor.

Closes #373

Type of change

  • Bug fix
  • Feature (requires approved Discussion)
  • Refactor (no behavior change)
  • Documentation
  • Performance improvement
  • Tests
  • Chore (dependencies, CI, tooling)

Checklist

  • I have read CONTRIBUTING.md
  • pnpm typecheck passes
  • pnpm --silent lint:json | jq '.diagnostics | length' returns 0 new diagnostics (only the pre-existing packages/admin/src/router.tsx warning remains, unrelated to this change)
  • pnpm test passes (targeted: packages/core capabilities integration suite — 54 tests pass, including the new cases covering slug/status on get(), list(), and create())
  • pnpm format has been run
  • I have added/updated tests for my changes (if applicable)
  • I have added a changeset (if this PR changes a published package)
  • New features link to an approved Discussion: https://github.com/emdash-cms/emdash/discussions/... (N/A — bug fix)

AI-generated code disclosure

  • This PR includes AI-generated code

Screenshots / test output

✓ tests/integration/plugins/capabilities.test.ts (54 tests) 2660ms

Test Files 1 passed (1)
Tests 54 passed (54)

New test cases added:

  • exposes slug and status on items returned from get()
  • exposes slug and status on items returned from list()
  • extended can create new content to assert slug and status are present on the created item

The plugin content API (`ctx.content.get()` / `ctx.content.list()`)
was returning `ContentItem` without the `slug` or `status` fields,
even though the underlying row has both. Migration, SEO, and any
other plugin that needs to match external data to content by slug
had to fall back to fragile title matching.

Add `slug` (nullable) and `status` to `ContentItem` and populate
them in the read and write adapters.

Closes emdash-cms#373
@changeset-bot
Copy link
Copy Markdown

changeset-bot bot commented Apr 11, 2026

🦋 Changeset detected

Latest commit: 038fa72

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 9 packages
Name Type
emdash Patch
@emdash-cms/cloudflare Patch
@emdash-cms/plugin-ai-moderation Patch
@emdash-cms/plugin-atproto Patch
@emdash-cms/plugin-audit-log Patch
@emdash-cms/plugin-color Patch
@emdash-cms/plugin-embeds Patch
@emdash-cms/plugin-forms Patch
@emdash-cms/plugin-webhook-notifier Patch

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

@all3f0r1
Copy link
Copy Markdown
Contributor Author

@ascorbic please let me know when you want me to rebase.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[plugins] ctx.content.list/get() returns ContentItem without slug field

1 participant