Content and CMS
Everything a visitor can read is content you can edit without touching code: page sections, headings, buttons, labels, error messages, emails, SEO texts, photos and their alt text.
One content model
Section titled “One content model”Each template describes its content once, in src/content/model.ts. The editors are generated
from it, so they always offer exactly the fields your pages use:
- Files and Keystatic (default): your content stays in the project as Markdown and JSON
files, and Keystatic is a friendly editor for them at
/keystatic. No service, no extra cost. See Files and Keystatic. - Sanity: your content lives in a Sanity project and your team edits it in Sanity Studio. See Sanity.
- EmDash: a separate variant of the template, chosen when you create the site
(
npx wptom new my-site -t handy --cms emdash). EmDash runs inside your site on Cloudflare, with a WordPress-like admin, and what you publish is live at once. See EmDash.
Your pages don’t change between them: the site reads the same fields from every source.
Which one should I pick?
Section titled “Which one should I pick?”| Files and Keystatic | Sanity | EmDash | |
|---|---|---|---|
| Who edits | You on your computer; on the live site, anyone with a GitHub account and write access to the repository | Members of your Sanity project, in Sanity Studio | Users you invite in the admin, signing in with passkeys |
| Where content lives | Files in your repository | Your Sanity project | A D1 database and an R2 bucket in your Cloudflare account |
| Hosting | Any host for the static site; editing on the live site is set up for Vercel | Any host (static site) | Cloudflare Workers |
| Cost | No extra service | Sanity’s own plans (see sanity.io/pricing) | Cloudflare Workers Paid for a live site ($5 a month) |
| After publishing | Each save is a commit; the host rebuilds (a minute or two) | A webhook starts a rebuild (a minute or two) | Live at once |
| Choose it when | You edit the site yourself, or a client is happy with a GitHub account | Several editors or a client want a hosted editor with drafts, without GitHub | You want a WordPress-like admin with instant publishing and are fine hosting on Cloudflare |
Files and Sanity come in the same variant: you can start with files and move to Sanity later by switching one setting. EmDash is a different variant, chosen when you create the site.
Where the content lives
Section titled “Where the content lives”In the files/Sanity variant, as files in your project (<language> is the language code, en
in a site with one language):
| What | Files |
|---|---|
| Single pages (home, contact, 404…) | src/content/singletons/<language>/<page>.json |
| Site settings, navigation, footer | src/content/singletons/<language>/site.json |
| Small interface texts (buttons, labels, emails) | src/content/singletons/<language>/ui.json |
| Brand (colors, fonts, shape) | src/content/singletons/brand.json |
| Collections (services, posts, legal pages…) | src/content/<collection>/<language>/<slug>.md (some collections, such as landing pages, use .json) |
| Photos | src/assets/photos/<page or collection>/ |
With Sanity, everything except the brand moves to your Sanity project. In the EmDash variant, content lives in EmDash and photos in its media library.
Choosing the source (files or Sanity)
Section titled “Choosing the source (files or Sanity)”In the files/Sanity variant, set CMS in .env (or in your host’s environment variables):
CMS=files # default: the files above, edited in KeystaticCMS=sanity # read from your Sanity projectContent is read when the site is built, so the published site stays fast and static. After editing, the site rebuilds: with Keystatic on the live site every save is a commit that starts a build, with Sanity a webhook starts it. (In the EmDash variant, pages are rendered on request instead, so there’s no rebuild.)
