SuperAPI AI 工具集

building-emdash-site

前端与建站

查看项目

更新于 10-16 05:07

技能介绍

用途:本技能用于构建 EmDash CMS 项目中面向站点的部分。EmDash 是基于 Astro 的 CMS,schema 存于数据库而非代码,通过实时内容集合提供内容,后台位于 /_emdash/admin。站点是带 emdash 集成的标准 Astro 项目。

主要能力与用法:流程包括配置项目(astro.config.mjs、live.config.ts、部署目标、类型生成)、设计 schema、构建页面、接入站点功能、编写 seed/seed.json、运行验证。常用 API 来自 "emdash",如 getEmDashCollection、getEmDashEntry,以及 getSiteSettings、getMenu、getTaxonomyTerms、getTerm、getEntryTerms、getEntriesByTerm、getWidgetArea、search、getSection、getSeoMeta 等;UI 组件来自 "emdash/ui",如 PortableText、Blocks、Image、WidgetArea、EmDashHead 等;评论与搜索来自 "emdash/ui/comments"、"emdash/ui/search"。插件可在 astro.config.mjs 中通过 plugins 注册,用于 hooks、存储、设置、后台 UI、API 路由和自定义 Portable Text 块。

限制与注意事项:图片字段是对象而非字符串,需用 <Image image={post.data.featured_image} />;entry.id 是带 locale 前缀的 slug,entry.data.id 是数据库 ULID,混用会导致空结果;分类法名称必须与 seed 完全一致;启用 Astro 缓存时需传递 cacheHint;CMS 内容不能用 getStaticPaths,页面必须服务端渲染。示例运行命令为 pnpm dev,后台地址 http://localhost:4321/_emdash/admin。更详细的配置、schema、查询与站点功能见对应参考文档。