building-emdash-site
Building an EmDash Site
EmDash is a CMS built on Astro. It stores schema in the database (not in code), serves content via live content collections, and provides a full admin UI at /_emdash/admin. Sites are standard Astro projects with the emdash integration.
Common Gotchas
These are the things that silently break sites. Know them before you start.
-
Image fields are objects, not strings.
post.data.featured_imageis{ id, src, alt }. Writing<img src={post.data.featured_image} />renders[object Object]. Use<Image image={post.data.featured_image} />from"emdash/ui". -
entry.idvsentry.data.idare different things.entry.idis the slug (use in URLs).entry.data.idis the database ULID (use forgetEntryTerms,Comments, and other API calls that need the real ID). Mixing them up causes silent empty results. -
Taxonomy names must match the seed exactly. If your seed defines
"name": "category", you must querygetTerm("category", slug)-- not"categories". Wrong name = empty results, no error. -
Always pass
cacheHinttoAstro.cache.set(). Every query returns acacheHint. CallAstro.cache.set(cacheHint)on every page that queries content, or cache invalidation won't work when editors publish changes. -
No
getStaticPathsfor CMS content. EmDash content is dynamic. Pages must be server-rendered (output: "server"inastro.config.mjs).