Skip to content

Instant publishing

Content goes live on every commit, without a rebuild. When an editor publishes, Alinea commits the change to your repository and your site starts serving it right away.

How it works

Every publish in the dashboard is a git commit. After the commit, the site syncs the new content sha from its own handler, so the next request that renders content reads the latest version. No build or redeploy has to finish before editors see their changes on the live site.

Skip builds for content-only commits

Because content is synced at runtime, a commit that only changes content does not need a new deployment. On Vercel you can skip those builds with an ignoreCommand in vercel.json. The command exits successfully, which tells Vercel to skip the build, when nothing outside the content directory changed:

vercel.json
{
  "ignoreCommand": "git diff --quiet HEAD^ HEAD -- . ':!content'"
}

Revalidate pages after a commit

Pages that are rendered at request time pick up new content immediately. Static pages were rendered ahead of time and keep serving the old content until they are revalidated. Use the handler's afterCommit hook to revalidate them whenever content is published:

app/api/cms/route.ts
import {cms} from '@/cms'
import {createHandler} from 'alinea/next'
import {revalidatePath} from 'next/cache'

const handler = createHandler({
  cms,
  afterCommit() {
    revalidatePath('/', 'layout')
  }
})

export const GET = handler
export const POST = handler

revalidatePath('/', 'layout') marks every page as stale, so the next visit to any page renders it with the new content. Narrow it down to specific paths if you only want to revalidate the pages that changed.