Langsung ke konten
Skillpedia
API & server (backend)14k Β· #11246

building-emdash-site

Fungsinya

Skill ini membantu membangun situs web di EmDash, sebuah sistem manajemen konten yang dibangun di atas Astro, termasuk kueri konten, render halaman, dan pengaturan situs. Untuk developer web yang membuat atau mengubah situs EmDash.

Kapan dipakai

  • βœ“Saat Anda memulai situs web baru di EmDash dan perlu mengatur struktur kontennya.
  • βœ“Saat Anda perlu menampilkan konten seperti postingan, menu, atau kategori di situs.
  • βœ“Saat gambar, istilah taksonomi, atau konten tidak muncul dan Anda perlu mencari penyebabnya.

Link skill

https://github.com/emdash-cms/emdash/blob/main/skills/building-emdash-site/SKILL.md

Salin lalu tempelkan ke AI Anda (Claude, ChatGPT, atau Cursor) dan minta AI mengikuti instruksinya.

Cara pakai

Cara paling mudah: salin pesan ini dan tempelkan ke AI Anda. AI akan membaca skill dan mengikuti instruksinya.

Pesan siap tempel

Gunakan skill ini untuk membantu saya: https://github.com/emdash-cms/emdash/blob/main/skills/building-emdash-site/SKILL.md Baca file SKILL.md di link tersebut dan ikuti instruksinya untuk tugas saya.
Mau AI Anda menemukan skill seperti ini sendiri?Pasang MCP Skillpedia gratis: cukup satu baris, dan AI mencari di antara 15.000+ skill sebelum tiap tugas.Pasang dalam 1 menit β†’

Contoh permintaan ke AI

β€œBisakah Anda membantu saya menyiapkan bagian blog di situs EmDash saya, dengan kategori dan gambar unggulan pada setiap postingan?”

5 skill baru setiap minggu. 1 menit baca.

Cara kerjanya

Agent mengatur skema konten dan data awal, menulis kueri untuk konten, dan merender hasilnya dengan komponen Astro. Agent juga menandai jebakan umum, seperti field gambar yang berupa objek, bukan teks biasa.

Konten teknis (SKILL.md asli)

Teks asli dari pembuat, dalam bahasa Inggris, langsung dari GitHub.

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.

  1. Image fields are objects, not strings. post.data.featured_image is { id, src, alt }. Writing <img src={post.data.featured_image} /> renders [object Object]. Use <Image image={post.data.featured_image} /> from "emdash/ui".

  2. entry.id vs entry.data.id are different things. entry.id is the slug, prefixed with the locale (en/my-post) for locales whose URLs are prefixed (use in URLs; entry.data.slug is the bare slug). entry.data.id is the database ULID (use for getEntryTerms, Comments, and other API calls that need the real ID). Mixing them up causes silent empty results.

  3. Taxonomy names must match the seed exactly. If your seed defines "name": "category", you must query getTerm("category", slug) -- not "categories". Wrong name = empty results, no error.

  4. Register cache hints when Astro's cache is enabled. Content queries return a cacheHint; pass it to Astro.cache.set(cacheHint). Use getSiteSettingsWithCacheHint(), getMenuWithCacheHint(), getTaxonomyTermsWithCacheHint(), and getWidgetAreaWithCacheHint() when a cached route renders those values.

  5. No getStaticPaths for CMS content. EmDash content is dynamic. Pages must be server-rendered (output: "server" in astro.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
Pertanyaan umum

Apa itu EmDash?

Sistem manajemen konten yang dibangun di atas Astro dan menyimpan strukturnya di basis data.

Mengapa gambar saya tampil sebagai teks objek?

Field gambar berupa objek, sehingga harus ditampilkan dengan komponen gambar, bukan sebagai teks biasa.

Apakah mencakup layar admin?

Ya. EmDash menyediakan antarmuka admin bawaan untuk mengedit konten.

Detail

Deskripsi asli dari pembuat

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

Popularitas

Bintang GitHub
14k
Peringkat
#11246
Lisensi
MIT
Diperbarui
2/11/2026

Apakah skill ini berguna?

0

Masuk untuk memberi suara.

Komentar

  • …

Skill lain dari repositori ini

Skill serupa