building-emdash-site
Skill này làm gì
Skill giúp xây dựng website trên EmDash, một hệ quản trị nội dung dựa trên Astro, gồm truy vấn nội dung, hiển thị trang và thiết lập site. Skill dành cho lập trình viên web tạo hoặc thay đổi một site EmDash.
Khi nào nên dùng
- ✓Khi bạn bắt đầu một website mới trên EmDash và cần thiết lập cấu trúc nội dung.
- ✓Khi bạn cần hiển thị nội dung như bài viết, menu hoặc danh mục trên site.
- ✓Khi ảnh, thuật ngữ taxonomy hoặc nội dung không hiển thị và bạn cần tìm nguyên nhân.
Liên kết skill
https://github.com/emdash-cms/emdash/blob/main/skills/building-emdash-site/SKILL.mdSao chép rồi dán vào AI của bạn (Claude, ChatGPT hoặc Cursor) và nhờ nó làm theo hướng dẫn.
Cách dùng
Cách dễ nhất: sao chép tin nhắn và dán vào AI của bạn. AI sẽ đọc skill và làm theo hướng dẫn.
Tin nhắn có sẵn để dán
Dành cho Claude Code, Codex hoặc Cursor: chạy lệnh trong thư mục dự án của bạn và skill sẽ được cài đặt.
Tải tệp SKILL.md về và thả vào thư mục skill của agent.
Ví dụ cách nhờ AI
“Bạn có thể giúp tôi thiết lập một mục blog trên site EmDash của mình, với danh mục và ảnh nổi bật cho mỗi bài viết không?”
5 skill mới mỗi tuần. Đọc chỉ 1 phút.
Cách hoạt động
Agent thiết lập schema nội dung và dữ liệu mẫu, viết truy vấn cho nội dung, rồi hiển thị kết quả bằng các component Astro. Nó cũng chỉ ra các lỗi thường gặp, chẳng hạn các trường ảnh là đối tượng chứ không phải văn bản thuần.
Nội dung kỹ thuật (SKILL.md gốc)
Lấy nguyên văn từ GitHub, do tác giả viết bằng tiếng Anh.
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, prefixed with the locale (en/my-post) for locales whose URLs are prefixed (use in URLs;entry.data.slugis the bare slug).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.Register cache hints when Astro's cache is enabled. Content queries return a
cacheHint; pass it toAstro.cache.set(cacheHint). UsegetSiteSettingsWithCacheHint(),getMenuWithCacheHint(),getTaxonomyTermsWithCacheHint(), andgetWidgetAreaWithCacheHint()when a cached route renders those values.No
getStaticPathsfor CMS content. EmDash content is dynamic. Pages must be server-rendered (output: "server"inastro.config.mjs).
File Structure
Every EmDash site has these key files:
my-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.json
Workflow
1. Configure the project
Read references/configuration.md for astro.config.mjs, live.config.ts, deployment targets (Node vs Cloudflare), and type generation.
2. Design the schema
Read references/schema-and-seed.md for collection definitions, field types, taxonomies, menus, widget areas, sections, bylines, and the complete seed file format.
3. Build the pages
Read references/querying-and-rendering.md for content queries, Portable Text rendering, the Image component, visual editing attributes, caching, and common page patterns (list, detail, taxonomy archive, RSS, search, 404).
4. Wire up site features
Read references/site-features.md for site settings, navigation menus, taxonomies, widget areas, search, SEO meta, comments, and page contributions.
5. Create the seed file
Write seed/seed.json with collections, fields, taxonomies, menus, widgets, and sample content.
6. Run and verify
pnpm dev # Start the Astro dev server
The runtime runs pending migrations on the first request and, before setup is completed, applies the seed's schema and structure once. Sample content needs an explicit step; see Applying Seeds. The Astro integration generates emdash-env.d.ts when the server starts. The admin UI is at http://localhost:4321/_emdash/admin.
Quick API Cheat Sheet
// 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 ent
Câu hỏi thường gặp
EmDash là gì?
Là một hệ quản trị nội dung xây dựng trên Astro, giữ cấu trúc của nó trong cơ sở dữ liệu.
Vì sao ảnh của tôi hiện thành chữ object?
Các trường ảnh là đối tượng, nên phải hiển thị bằng component ảnh thay vì như văn bản thuần.
Nó có bao gồm giao diện quản trị không?
Có. EmDash cung cấp sẵn giao diện quản trị để chỉnh sửa nội dung.
Chi tiết
Mô tả gốc của tác giả
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.
repo: emdash-cms/emdash
Độ phổ biến
- Sao GitHub
- 14k
- Vị trí xếp hạng
- #11246
- Giấy phép
- MIT
- Cập nhật
- 2/11/2026
Bình luận
- …
Thêm skill từ kho mã này
adversarial-reviewer
14kGiúp agent của bạn tìm lỗi ẩn và các giả định không an toàn trong một thay đổi code, vượt qua một đánh giá thông thường khi bạn yêu cầu.
agent-browser
14kCho phép agent của bạn kiểm thử trang web trong trình duyệt thật, kiểm tra người dùng thấy gì, xác minh hành động và chụp ảnh màn hình làm bằng chứng.
creating-plugins
14kGiúp agent của bạn tạo plugin cho hệ thống CMS EmDash, với hook, route, lưu trữ và giao diện quản trị an toàn.
emdash-cli
14kCho phép agent của bạn quản lý trang EmDash từ dòng lệnh, gồm nội dung, media, menu, migration và xuất hoặc nhập toàn bộ trang.
Skill tương tự
api-connector-builder
280kGiúp agent của bạn xây dựng kết nối API mới theo đúng mẫu đã có, dùng khi bạn cần thêm một tích hợp mà không tạo cách làm mới.
api-design
280kGiúp agent của bạn thiết kế REST API theo các thực hành tốt nhất, hữu ích để định nghĩa cách API giao tiếp, hiển thị lỗi và tổ chức dữ liệu.
backend-patterns
280kGiúp agent của bạn với các mẫu kiến trúc phía máy chủ và tối ưu cơ sở dữ liệu, hữu ích khi xây dựng hoặc rà soát code chạy trên máy chủ.