Skip to content
TurnIntoCMS

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:

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.

SituationContent in codeHeadless CMS
Brochure or portfolio site, 5 to 15 pagesGood fitUsually more than needed
Edits a few times a monthGood fitWorks, but adds a system
Daily publishing, many postsGit history gets noisyGood fit
One or two editorsGood fitWorks
Five or more editors with different rolesHard to manageGood fit
Posts must go live at a set timeNeeds a manual mergeGood fit if the plan includes scheduling
A mobile app or second site reads the same contentAwkwardGood fit
Client wants to edit on the page itselfGood fit with a visual editorDepends 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.

TaskContent in codeHeadless CMS
Initial setupMove copy into data files or MarkdownCreate a project, define a content model, add API queries to every page
Adding a new fieldAdd a key to the data fileChange the schema, fill existing entries, update queries
Previewing unpublished editsBranch preview from your hostConfigure a preview mode against draft content
History and backupsGit historyThe vendor's history features or exports
HandoffClient gets access to the editor or repoClient gets CMS accounts and roles; you keep the schema in sync
Ongoing upkeepDependency updates you already doCMS 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

  1. Shape each data file as a list of records: an array of objects with the same keys.
  2. Turn each file into a content type with the same field names.
  3. 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.
  4. Replace the imports in each page with API queries, one page at a time,.

From a headless CMS back to files

  1. Export everything first. Sanity's CLI downloads a dataset's documents and asset binaries to a local gzipped tarball.
  2. Write a small script that turns each document into a JSON file or a Markdown file.
  3. Copy images into the repository and rewrite their paths.
  4. 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

  1. Store and query structured content | Sanity Docs (sanity.io, checked November 18, 2026)
  2. Studio | Sanity Docs (sanity.io, checked November 18, 2026)
  3. Welcome to the Strapi CMS Documentation! | Strapi 5 Documentation (docs.strapi.io, checked November 18, 2026)
  4. Releases | Strapi 5 Documentation (docs.strapi.io, checked November 18, 2026)
  5. How to use markdown and MDX in Next.js (nextjs.org, checked November 18, 2026)
  6. Decap CMS overview (decapcms.org, checked November 18, 2026)
  7. Importing Data in Bulk including File & Image Assets | Sanity Docs (sanity.io, checked November 18, 2026)
  8. Export a Sanity Dataset with the CLI | Sanity Docs (sanity.io, checked November 18, 2026)

Related

More from the blog

Let your clients edit the site you coded

One website free. Then $1 each, paid once.

Get started free