API-Referenz
Die wichtigsten Funktionen und Typen aller @setzkasten-cms/*-Packages auf einen Blick.
setzkasten:content
Das virtuelle Modul stellt drei Funktionen bereit, um CMS-Content in Astro-Seiten zu nutzen.
| Funktion | Signatur | Beschreibung |
|---|---|---|
| getSection | (key: string) => Record<string, unknown> | undefined | Felder einer Section lesen |
| getCollection | (key: string) => Record<string, unknown>[] | Alle Einträge einer Collection |
| getCollectionEntry | (col: string, slug: string) => Record<string, unknown> | undefined | Einzelnen Eintrag per Slug |
src/pages/index.astro
import { getSection, getCollection, getCollectionEntry } from 'setzkasten:content'
const hero = getSection('hero')
const posts = getCollection('blog')
const post = getCollectionEntry('blog', 'mein-erster-post') @setzkasten-cms/core — Schema
Schema-Definition mit vollständiger TypeScript-Typisierung.
| Funktion | Beschreibung |
|---|---|
| defineConfig(config) | Root-Config (storage, products, collections) |
| defineSection(options) | Section mit Label, Icon und Feldern |
| defineCollection(options) | Collection mit Label und Feldern |
| f.text(options) | Text-Feld (einzeilig, optional formatting: true) |
| f.richtext(options) | Mehrzeiliger Rich Text (TipTap) |
| f.image(options) | Bild-Upload oder URL |
| f.number(options) | Zahlenwert mit optionalem min/max |
| f.boolean(options) | Ein/Aus-Schalter |
| f.select(options) | Dropdown aus definierten Optionen |
| f.array(options) | Liste von Objekten |
| f.color(options) | Farbpicker mit Hex-Input |
| f.date(options) | Datum/Uhrzeit-Picker |
| f.icon(options) | Lucide-Icon-Picker |
@setzkasten-cms/astro — Integration
Alle Optionen der Astro-Integration — siehe auch die Konfigurationsseite.
| Option | Typ | Beschreibung |
|---|---|---|
| adminPath | string | Pfad zur Admin-UI (Standard: /admin) |
| storage | StorageConfig | GitHub-Adapter-Konfiguration |
| github | OAuthConfig | GitHub OAuth Credentials |
| OAuthConfig | Google OAuth Credentials | |
| allowedEmails | string[] | Erlaubte E-Mails (nur Google OAuth) |
| deployHook | { url, secret? } | Deploy-Hook nach Content-Commits |
→ Vollständige Konfigurationsreferenz: /docs/configuration