The first time I deployed the Keystatic admin for this blog, every collection showed "Unable to load". The browser was running Keystatic in local mode and asking the server for /api/keystatic/tree, while the server, already in GitHub mode, answered with a 404.
Keystatic CMS is the editor behind seodraft's blog, which runs on Next.js and deploys on Vercel. I picked it for the simplicity of working git-based: every post is a file in the repository, and seodraft delivers approved drafts straight into that folder.
On October 13, 2026, the first eight Google results for "keystatic cms" were two pages of Keystatic's docs, its Cloud login, a comparison with Decap CMS, a GitHub discussions page and three write-ups, one of them an Astro guide. This post adds the production side, with the seven decisions that got the setup working and the config behind each one.
Lesson 4 covers a bilingual blog, where English and Spanish posts need separate collections so each language keeps its own slug. Start with what Keystatic stores and where.
- 1. Keystatic edits the files already in your repo
- 2. Choose the storage mode before the first post
- 3. Run the deployed admin in GitHub mode on Vercel
- 4. Give each language its own collection
- 5. Put your SEO fields and a draft box in the schema
- 6. Store images under public/ so their URLs resolve
- 7. Let agent drafts arrive as files the admin can open
- Choose Keystatic when your posts can live in Git
1. Keystatic edits the files already in your repo
Keystatic is a content editor that reads and writes the Markdown, Markdoc, JSON or YAML files in your codebase, and it needs no database.
You describe each content type in keystatic.config.ts, and the admin UI at /keystatic turns that schema into forms. Its docs ship integration guides for Next.js, Astro and Remix.
On this blog a post is a .mdoc file under content/blog/en/ or content/blog/es/, edited with @keystatic/core 0.6 on Next.js 16. Saving in the admin writes that file, and in GitHub mode the save becomes a commit you can review or revert.
2. Choose the storage mode before the first post
Keystatic has three storage modes, and the one you pick decides who can edit and where each save goes.
local writes to your own disk, which suits development and a first prototype. github reads and writes a GitHub repository through a GitHub App you create from the admin, and every editor needs write access to that repo.
cloud hands sign-in to Keystatic Cloud, so someone without a GitHub account can edit. Its docs, read on October 13, 2026, list a free plan with up to 3 users per team and a Pro plan from $10 a month, plus $5 per user beyond 3.
This blog runs local mode on my machine and GitHub mode in production. It does not use the cloud mode.
3. Run the deployed admin in GitHub mode on Vercel
A Keystatic admin deployed on Vercel has to use GitHub mode, because Vercel's filesystem is read-only and the admin can only save by committing.
Keystatic's docs also ask for a host that runs Node.js for its API routes, and you copy the Keystatic environment variables to the deployed project. The GitHub App wizard has to run from localhost, since that flow creates KEYSTATIC_GITHUB_CLIENT_ID, KEYSTATIC_GITHUB_CLIENT_SECRET, KEYSTATIC_SECRET and the app slug variable.
The bug from the intro came from the switch between modes. I chose the mode with an environment variable holding the repo name, but keystatic.config.ts is also imported by the admin, which is a client component, and a plain variable is undefined in the browser bundle.
Renaming it with the NEXT_PUBLIC_ prefix fixed it. The repo name is the only value it exposes.
// keystatic.config.ts
function storage() {
const repo = process.env.NEXT_PUBLIC_KEYSTATIC_GITHUB_REPO;
if (!repo) return { kind: "local" } as const;
const [owner, name] = repo.split("/");
return { kind: "github", repo: { owner, name } } as const;
}
4. Give each language its own collection
A bilingual Keystatic blog works best with one collection per language, because a slug only has to be unique inside its collection.
In a single collection, the English and Spanish versions of one post could never share a slug. With two collections, an untranslated post simply has no sibling, and the site only advertises an hreflang alternate when that file exists.
We pair translations with a translationKey field that holds the same value on every language version. That lets the Spanish post keep a Spanish slug, and it stops two unrelated posts that happen to share a slug from being declared translations of each other.
5. Put your SEO fields and a draft box in the schema
The Keystatic schema is where a post's SEO fields become required, so an empty description never reaches the live site.
Ours requires a description of up to 200 characters, because it feeds the meta description and the blog index. It adds a tldr and FAQs that answer engines can lift whole, tags, and an updatedAt date for the sitemap's lastmod, since a fresh checkout rewrites every file's modified time.
The draft checkbox hides a post from the blog and from the sitemap. On November 23, 2026, seodraft's sitemap listed 164 URLs, 50 of them blog posts: 27 in English and 23 in Spanish. The free sitemap checker gives you the same count for your own site after each deploy.
6. Store images under public/ so their URLs resolve
Images in a Keystatic blog need a folder your site actually serves, which on Next.js means public/.
Keystatic's default saves an image next to its entry, under content/, with a src relative to the post. Nothing served that folder on our site, so those images returned a 404.
Our image field sets the directory to public/blog-images/en or public/blog-images/es and the public path to match, so the src Keystatic writes is the URL that serves the file. A short transformFilename strips accents and spaces, so a screenshot's default name never turns into %20 in a URL.
image: {
directory: `public/blog-images/${locale}`,
publicPath: `/blog-images/${locale}/`,
},
7. Let agent drafts arrive as files the admin can open
An AI agent can write into a Keystatic blog when each draft arrives as a file with the frontmatter your schema expects.
My agent writes through seodraft, and when I approve a post seodraft commits it to content/blog/{locale}/{slug}.mdoc with draft: true. It maps the post date to publishedAt and the updated date to updatedAt, so Keystatic opens the file like any post I wrote by hand.
One field needed a fix. Delivered posts carry {% #id %} anchors on headings for the table of contents, and Keystatic's editor rejects heading attributes its schema does not declare, so those files would not open until I added id to the heading schema.
Before any file reaches the repo, the draft goes through a fixed order. The current workflow saves the brief before the body and requires every evidence item in the brief to reach the article.
Publishing stays my call. In my first test of seodraft, on September 17, 2026, the run ended with the post marked ready. The workflow stopped at READY: I did not call delivery or publish the article.
Going live means pressing Publish in seodraft.app, which commits the file with draft: false. The CMS delivery page lists the path and frontmatter options seodraft can write.
Choose Keystatic when your posts can live in Git
Choose Keystatic when the people who edit your blog can work from a Git repository, and switch to its cloud mode when someone without a GitHub account needs to edit.
For a founder-run blog on Next.js, I would start in local mode, write the schema with the SEO fields and the draft box, and only then move production to GitHub mode with the NEXT_PUBLIC_ variable from lesson 3. If you are still picking a framework, the Astro version of this setup uses the same Keystatic pieces.
When you want the briefs, the rules and draft delivery into your Keystatic repo handled for you, try seodraft with your own agent (Claude, Cursor, or ChatGPT on Business, Enterprise or Edu). It costs $9 a month for one workspace, and the 7-day trial needs no card: your agent writes, the rules decide, you approve.
