Zum Inhalt springen

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.

FunktionSignaturBeschreibung
getSection(key: string) => Record<string, unknown> | undefinedFelder einer Section lesen
getCollection(key: string) => Record<string, unknown>[]Alle Einträge einer Collection
getCollectionEntry(col: string, slug: string) => Record<string, unknown> | undefinedEinzelnen 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.

FunktionBeschreibung
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.

OptionTypBeschreibung
adminPathstringPfad zur Admin-UI (Standard: /admin)
storageStorageConfigGitHub-Adapter-Konfiguration
githubOAuthConfigGitHub OAuth Credentials
googleOAuthConfigGoogle OAuth Credentials
allowedEmailsstring[]Erlaubte E-Mails (nur Google OAuth)
deployHook{ url, secret? }Deploy-Hook nach Content-Commits
→ Vollständige Konfigurationsreferenz: /docs/configuration