From 9ebc8b1f3f9abf4819b2d3863be3b64194d1ab8f Mon Sep 17 00:00:00 2001 From: Matt Kane Date: Sat, 4 Apr 2026 09:17:00 +0100 Subject: [PATCH] docs: audit and fix documentation for release (#230) * docs: fix critical errors in import paths, types, and API references - Fix Cloudflare adapter imports: d1/r2 come from @emdash-cms/cloudflare, not emdash/db or emdash/astro - Fix PortableText import path: emdash/ui, not emdash/astro - Replace set:html with PortableText component for Portable Text content - Fix CLI binary alias: em, not ec - Fix media upload API: POST multipart to /api/media, not JSON to /api/media/upload - Fix MediaValue type: src not url, provider is optional, add previewUrl - Fix EmDashMedia to Image component (actual export name) - Fix Cloudflare Access auth config: use access() function, not nested object - Fix REST API methods: content/media update is PUT not PATCH, settings is POST not PUT - Fix contributing docs: Node.js 22+, pnpm 10+, correct E2E test command - Fix WordPress migration: remove undocumented CLI import command * docs: fix high-priority technical errors across docs - Fix hook names: beforeSave/afterSave, not beforeCreate/afterCreate - Fix status values: draft/published/scheduled, not archived - Fix field type count: 14, not 15 - Fix MCP tool count: 33, not 28 - Fix Section.previewUrl type: string, not object - Fix getSections examples to show { items } destructuring - Add missing CollectionSupport values: search, seo - Update reserved field slugs to match actual code - Add MCP server enablement note (mcp: true required) - Clarify getStaticPaths guidance: themes must be SSR, other sites can use static - Delete orphaned duplicate migration/plugin-porting.mdx * docs: fix medium-priority issues across docs - Fix broken internal links: /guides/media/ -> /guides/media-library/, /guides/seeding/ -> /themes/seed-files/ - Standardize env var to EMDASH_PREVIEW_SECRET throughout preview guide - Fix featuredImage -> featured_image in widgets guide - Remove Discord social link (no Discord server exists) - Fix formatting config reference: .oxfmtrc.json, not .prettierrc - Add audienceEnvVar to Cloudflare Access config options - Fix content model type declarations to show actual return types * docs: document missing plugin hooks, capabilities, and context properties - Add 10 missing hooks to reference: cron, email (beforeSend, deliver, afterSend), comment (beforeCreate, moderate, afterCreate, afterModerate), page (metadata, fragments) - Document all hook event types, handler signatures, and return values - Add exclusive hook option to configuration tables - Add 6 missing capabilities: network:fetch:any, read:users, email:send/provide/intercept, page:inject - Add 6 missing context properties: ctx.site, ctx.url(), ctx.users, ctx.cron, ctx.email - Update hooks reference tables in both plugins/hooks.mdx and reference/hooks.mdx * Format --- .changeset/optimize-d1-indexes.md | 2 +- docs/astro.config.mjs | 5 - .../content/docs/concepts/architecture.mdx | 6 +- .../src/content/docs/concepts/collections.mdx | 7 +- .../content/docs/concepts/content-model.mdx | 8 +- docs/src/content/docs/contributing/index.mdx | 8 +- .../content/docs/deployment/cloudflare.mdx | 20 +- docs/src/content/docs/deployment/database.mdx | 5 +- docs/src/content/docs/deployment/storage.mdx | 6 +- docs/src/content/docs/guides/ai-tools.mdx | 10 + .../content/docs/guides/authentication.mdx | 33 +- .../src/content/docs/guides/create-a-blog.mdx | 5 +- .../src/content/docs/guides/media-library.mdx | 54 +- docs/src/content/docs/guides/preview.mdx | 12 +- .../content/docs/guides/querying-content.mdx | 14 +- docs/src/content/docs/guides/sections.mdx | 10 +- docs/src/content/docs/guides/widgets.mdx | 4 +- .../content/docs/migration/from-wordpress.mdx | 17 +- .../content/docs/migration/plugin-porting.mdx | 634 ------------------ docs/src/content/docs/plugins/hooks.mdx | 39 +- docs/src/content/docs/plugins/overview.mdx | 43 +- docs/src/content/docs/reference/cli.mdx | 2 +- .../content/docs/reference/field-types.mdx | 2 +- docs/src/content/docs/reference/hooks.mdx | 382 ++++++++++- .../src/content/docs/reference/mcp-server.mdx | 2 +- docs/src/content/docs/reference/rest-api.mdx | 6 +- .../content/docs/themes/creating-themes.mdx | 7 +- .../content/docs/themes/porting-wp-themes.mdx | 4 +- 28 files changed, 527 insertions(+), 820 deletions(-) delete mode 100644 docs/src/content/docs/migration/plugin-porting.mdx diff --git a/.changeset/optimize-d1-indexes.md b/.changeset/optimize-d1-indexes.md index 5c4ff2f..8ea704f 100644 --- a/.changeset/optimize-d1-indexes.md +++ b/.changeset/optimize-d1-indexes.md @@ -3,6 +3,6 @@ --- Optimizes D1 database indexes to eliminate full table scans in admin panel. Adds -composite indexes on ec_\* content tables for common query patterns (deleted_at + +composite indexes on ec\_\* content tables for common query patterns (deleted_at + updated_at/created_at + id) and rewrites comment counting to use partial indexes. Reduces D1 row reads by 90%+ for dashboard operations. diff --git a/docs/astro.config.mjs b/docs/astro.config.mjs index 40ec596..6e7c51e 100644 --- a/docs/astro.config.mjs +++ b/docs/astro.config.mjs @@ -19,11 +19,6 @@ export default defineConfig({ label: "GitHub", href: "https://github.com/emdash-cms/emdash", }, - { - icon: "discord", - label: "Discord", - href: "https://astro.build/chat", - }, ], editLink: { baseUrl: "https://github.com/emdash-cms/emdash/tree/main/docs", diff --git a/docs/src/content/docs/concepts/architecture.mdx b/docs/src/content/docs/concepts/architecture.mdx index 73d39d4..aefd213 100644 --- a/docs/src/content/docs/concepts/architecture.mdx +++ b/docs/src/content/docs/concepts/architecture.mdx @@ -69,7 +69,7 @@ CREATE TABLE ec_posts ( -- System columns (always present) id TEXT PRIMARY KEY, slug TEXT UNIQUE, - status TEXT DEFAULT 'draft', -- draft, published, archived + status TEXT DEFAULT 'draft', -- draft, published, scheduled author_id TEXT, created_at TEXT DEFAULT (datetime('now')), updated_at TEXT DEFAULT (datetime('now')), @@ -198,8 +198,8 @@ Uploads use signed URLs for direct client-to-storage uploads, bypassing Workers Plugins extend EmDash through a WordPress-inspired hook system: -- **Content hooks** — `beforeCreate`, `afterCreate`, `beforeUpdate`, `afterUpdate`, `beforeDelete` -- **Media hooks** — `beforeMediaUpload`, `afterMediaUpload` +- **Content hooks** — `content:beforeSave`, `content:afterSave`, `content:beforeDelete`, `content:afterDelete` +- **Media hooks** — `media:beforeUpload`, `media:afterUpload` - **Isolated storage** — Each plugin gets namespaced KV access - **Admin UI extensions** — Dashboard widgets, settings pages, custom field editors diff --git a/docs/src/content/docs/concepts/collections.mdx b/docs/src/content/docs/concepts/collections.mdx index 0ed7cef..f25d338 100644 --- a/docs/src/content/docs/concepts/collections.mdx +++ b/docs/src/content/docs/concepts/collections.mdx @@ -21,7 +21,7 @@ Create collections through the admin panel under **Content Types**. Each collect | `labelSingular` | Singular form (e.g., "Post") | | `description` | Optional description for editors | | `icon` | Lucide icon name for the admin sidebar | -| `supports` | Features like drafts, revisions, preview, scheduling | +| `supports` | Features like drafts, revisions, preview, scheduling, search, seo |