Headless CMS or content in code for small client sites
By Yash Garg · · 6 min read
For most small client sites, such as a brochure site, a portfolio or a local business with a handful of pages, keeping content in the repository is enough. Data files, Markdown or a Git-based CMS handle occasional edits with one less system to run. A hosted headless CMS earns its place when several people publish often, when posts must go live on a schedule, or when more than one app reads the same content through an API.
What each option actually is
A headless CMS
A headless CMS stores content in a hosted service and serves it to your site through an API. Sanity says its Content Lake stores your content as structured data, ready for delivery to any channel. Editors work in a separate admin app: Sanity Studio is an open-source content workbench where developers define content models using JavaScript objects. Strapi describes itself as an open-source headless CMS with an extensible admin panel and built-in role-based access control.
Content in code
Content in code means the words live in files in the same repository as the components. There are three common shapes:
- Data files. TypeScript or JSON modules that export strings and arrays, imported by pages. The guide on letting clients edit a Next.js site without a CMS covers this layout step by step.
- Markdown and MDX. Next.js can support both local MDX content inside your application and remote MDX files fetched on the server, so long pages and posts can sit in a folder next to your code.
- A Git-based CMS. An editing interface that writes those same files for the client. Decap CMS says content is stored in your Git repository alongside your code.
With content in code, every edit is a commit and every commit runs your normal build. With a headless CMS, content changes bypass Git and reach the site through the API, either at request time or on the next build.
Decision table
The page counts and editor numbers are examples, not hard limits.
| Situation | Content in code | Headless CMS |
|---|---|---|
| Brochure or portfolio site, 5 to 15 pages | Good fit | Usually more than needed |
| Edits a few times a month | Good fit | Works, but adds a system |
| Daily publishing, many posts | Git history gets noisy | Good fit |
| One or two editors | Good fit | Works |
| Five or more editors with different roles | Hard to manage | Good fit |
| Posts must go live at a set time | Needs a manual merge | Good fit if the plan includes scheduling |
| A mobile app or second site reads the same content | Awkward | Good fit |
| Client wants to edit on the page itself | Good fit with a visual editor | Depends on your preview setup |
If most of your answers land in the left column, stay in the repository. If two or more land in the right column, a headless CMS is likely worth the setup.
Scheduling and APIs are the real dividing line
Most arguments for a headless CMS on a small site come down to two features.
Scheduling. Strapi's Releases group entries so they publish together, and releases can be scheduled to publish automatically at a given date and time. The same page marks the feature as available with a Growth or Enterprise plan, so check the vendor's plan details before you promise a client scheduled posts.
Content in code has no built-in scheduler: a post goes live when its commit reaches the production branch. You can prepare it on a branch, but someone has to merge it on the day.
An API. If a second app or an in-store screen reads the same content, an API is the whole point of a headless CMS. Sanity lists GROQ, a GraphQL API and client libraries as ways to query and retrieve content from its store. If the only consumer is the website, data files imported at build time already give you typed content without a network call.
What each option costs in effort
Plans change, so compare the work instead.
| Task | Content in code | Headless CMS |
|---|---|---|
| Initial setup | Move copy into data files or Markdown | Create a project, define a content model, add API queries to every page |
| Adding a new field | Add a key to the data file | Change the schema, fill existing entries, update queries |
| Previewing unpublished edits | Branch preview from your host | Configure a preview mode against draft content |
| History and backups | Git history | The vendor's history features or exports |
| Handoff | Client gets access to the editor or repo | Client gets CMS accounts and roles; you keep the schema in sync |
| Ongoing upkeep | Dependency updates you already do | CMS SDK updates, API tokens, plan changes |
The hidden cost of a headless CMS on a small site is the content model. Every field the client can edit has to exist in the schema and in the query, so a request like "add a second button to the hero" touches three places instead of one.
The hidden cost of content in code is that the client needs a safe way to edit. Raw files on GitHub suit technical clients only; a Git-based CMS or a visual editor such as TurnIntoCMS writes the commit for them. Freelancers weighing those tools can start with the Git-based CMS guide for freelancers, then check the side by side comparison of editing tools or how a visual editor compares with Decap CMS.
Migration path both ways
Both directions stay open if your content is structured.
From content in code to a headless CMS
- Shape each data file as a list of records: an array of objects with the same keys.
- Turn each file into a content type with the same field names.
- Convert the records to the vendor's import format. Sanity, for example, imports newline-delimited JSON where each line is a valid JSON object containing one document.
- Replace the imports in each page with API queries, one page at a time,.
From a headless CMS back to files
- Export everything first. Sanity's CLI downloads a dataset's documents and asset binaries to a local gzipped tarball.
- Write a small script that turns each document into a JSON file or a Markdown file.
- Copy images into the repository and rewrite their paths.
- Swap API queries for imports, then remove the SDK and the API tokens.
Rich text is the slow part in both directions. Structured rich text rarely maps one to one onto Markdown, so set aside time to check formatting by hand.
Common mistakes
- A headless CMS for a site that changes twice a month. You pay for it in schema upkeep. Fix: start with data files and move when the decision table says so.
- Content left inside JSX. Neither a Git-based CMS nor a migration script can find it easily. Fix: pull client-editable copy into data files from the start.
- Promising scheduled posts on a repository setup. Fix: plan the merges yourself, or choose a CMS plan that includes scheduling.
- Mixed sources. Nobody knows where a sentence lives. Fix: one source per page, written down in the handoff notes.
- Migrating without an export. Fix: export first and keep the archive.
FAQ
Is a headless CMS overkill for a small business site?
Often, yes. If one or two people edit a few times a month and nothing else reads the content, files in the repository are simpler to run.
Can a client edit content in code without learning Git?
Yes. A Git-based CMS gives them a form and a visual editor lets them click the page itself; both commit the change for them.
When should I switch to a headless CMS?
Switch when the client needs scheduled publishing, several editors with different roles, or content shared with another app through an API.
Can I move from a headless CMS back into the repository?
Yes. Export the content, convert each document into a JSON or Markdown file, copy the images into the repo and replace API queries with imports.
Sources
- Store and query structured content | Sanity Docs (sanity.io, checked November 18, 2026)
- Studio | Sanity Docs (sanity.io, checked November 18, 2026)
- Welcome to the Strapi CMS Documentation! | Strapi 5 Documentation (docs.strapi.io, checked November 18, 2026)
- Releases | Strapi 5 Documentation (docs.strapi.io, checked November 18, 2026)
- How to use markdown and MDX in Next.js (nextjs.org, checked November 18, 2026)
- Decap CMS overview (decapcms.org, checked November 18, 2026)
- Importing Data in Bulk including File & Image Assets | Sanity Docs (sanity.io, checked November 18, 2026)
- Export a Sanity Dataset with the CLI | Sanity Docs (sanity.io, checked November 18, 2026)