Loading...
Loading...
Build the site-facing parts of an EmDash CMS project on Astro, including schema and seeds, content queries, Portable Text rendering, menus, taxonomies, widgets, and deployment configuration. Use for EmDash site and theme work; use creating-plugins instead when the task is plugin authoring alone.
npx skill4agent add emdash-cms/skills building-emdash-site/_emdash/adminemdashpost.data.featured_image{ id, src, alt }<img src={post.data.featured_image} />[object Object]<Image image={post.data.featured_image} />"emdash/ui"entry.identry.data.identry.iden/my-postentry.data.slugentry.data.idgetEntryTermsComments"name": "category"getTerm("category", slug)"categories"cacheHintAstro.cache.set(cacheHint)getSiteSettingsWithCacheHint()getMenuWithCacheHint()getTaxonomyTermsWithCacheHint()getWidgetAreaWithCacheHint()getStaticPathsoutput: "server"astro.config.mjsmy-site/
├── astro.config.mjs # Astro config with emdash() integration
├── src/
│ ├── live.config.ts # EmDash loader registration (boilerplate)
│ ├── pages/ # Astro pages (all server-rendered)
│ ├── layouts/ # Layout components
│ └── components/ # Reusable components
├── seed/
│ └── seed.json # Schema + demo content
├── emdash-env.d.ts # Generated types (from `emdash types`)
└── package.jsonastro.config.mjslive.config.tsseed/seed.jsonpnpm dev # Start the Astro dev serveremdash-env.d.tshttp://localhost:4321/_emdash/admin// Content (entries have .data.byline and .data.bylines eagerly loaded)
import { getEmDashCollection, getEmDashEntry } from "emdash";
const { entries, nextCursor, cacheHint } = await getEmDashCollection("posts", {
limit: 10,
cursor,
orderBy: { published_at: "desc" },
});
const { entry: post, cacheHint: entryCacheHint } = await getEmDashEntry("posts", slug);
// Site features
import {
getSiteSettings,
getSiteSettingsWithCacheHint,
getMenu,
getMenuWithCacheHint,
getTaxonomyTerms,
getTaxonomyTermsWithCacheHint,
getTerm,
getEntryTerms,
getEntriesByTerm,
getWidgetArea,
getWidgetAreaWithCacheHint,
search,
getSection,
getSeoMeta,
} from "emdash";
// Bylines (standalone queries -- usually not needed since entries have bylines attached)
import { getByline, getBylineBySlug } from "emdash";
// UI components
import {
PortableText,
Blocks,
defineBlockComponents,
Image,
WidgetArea,
EmDashHead,
EmDashBodyStart,
EmDashBodyEnd,
} from "emdash/ui";
import { Comments, CommentForm } from "emdash/ui/comments";
import LiveSearch from "emdash/ui/search";
// Page context (for plugin contributions)
import { createPublicPageContext } from "emdash/page";astro.config.mjsemdash({
database: sqlite({ url: "file:./data.db" }),
storage: local({ directory: "./uploads", baseUrl: "/_emdash/api/media/file" }),
plugins: [myPlugin()],
}),creating-plugins.agents/skills/creating-plugins/definePlugin()| File | Contents |
|---|---|
| references/configuration.md | Project setup, astro.config, live.config, deployment, types |
| references/schema-and-seed.md | Collections, fields, taxonomies, menus, widgets, seed format |
| references/querying-and-rendering.md | Content APIs, PortableText, Image, caching, page patterns |
| references/site-features.md | Settings, menus, widgets, search, SEO, comments, page contributions |