@wptom/cms-sanity
v0.1.1
Published
Sanity CMS for WPTom templates: Studio schema, Astro loader and seeding, all generated from the template's content model. No dependencies besides @wptom/content-model.
Maintainers
Readme
@wptom/cms-sanity
Sanity as the content source for a WPTom template. Everything is
generated from the template's content model (src/content/model.ts): the Studio schema with
its validation rules and navigation, the Astro content loader and the seeding of the demo
content. Pages don't change. Part of the WPTom integrations.
In a WPTom template:
pnpm cms sanity schema # writes studio/schema.json for the template's Studio (studio/)
pnpm cms sanity seed # uploads content and photos (SANITY_WRITE_TOKEN, Editor role)
CMS=sanity pnpm build # builds the site from SanitysanitySchema(specs): document types and navigation as JSON. Required fields, patterns and ranges come from the model; images allow cropping; Markdown bodies use the markdown editor (sanity-plugin-markdown); single pages are pinned to one document each.sanityContentLoader(...): reads published documents only (perspective=published), from the live API rather than the CDN, so a rebuild always sees what was just published. Images become CDN URLs (with the editor's crop) that Astro optimises like local files.toSanityDocument(),uploadImage(),seedDocuments(),existingDocuments(): seeding. Document ids never contain a dot (Sanity keeps those private).
Content loads at build time: add a Sanity webhook (create, update, delete) that calls your
host's deploy hook; pnpm cms sanity schema prints the filter. Requests are retried on rate
limits. No dependencies besides @wptom/content-model. MIT License.
