Skip to content

Preview Workflow ​

This is a remote workflow for editors who want to see their changes on a deploy preview before they go live, without a formal review process. It sits between the Simple Workflow, where a save goes live right away, and the Editorial Workflow, where a change moves through review stages before it can be published.

Saving an entry commits it to a branch of its own and opens a pull request, just like Editorial Workflow. Hosting services such as Netlify, Vercel and Cloudflare Pages build each pull request into a deploy preview, which the CMS links to from the entry. Once you’re happy with the result, publish the entry to merge its pull request. There are no statuses to move it through.

Use Cases ​

  • Individual bloggers or small teams who want to check a change on a real build before it goes live.
  • Sites whose pages are hard to judge from the editor’s preview pane alone, such as ones with complex layouts or data pulled from elsewhere.
  • Teams that want to save work in progress without publishing it, but have no one to review it.

Requirements ​

The requirements are the same as for Editorial Workflow: the GitHub, GitLab or Gitea/Forgejo backend, and a sign-in that covers pull requests. A hosting service that builds deploy previews from pull requests is what makes the workflow worthwhile, though the CMS doesn’t require one.

Configuration ​

Set the top-level publish_mode option to preview:

yaml
publish_mode: preview
toml
publish_mode = "preview"
json
{
  "publish_mode": "preview"
}
js
{
  publish_mode: 'preview',
}

Like the other publish modes, preview can also be set on a collection, overriding the top-level setting. See Enabling the Workflow per Collection.

The object form of the option takes the direct_publish and allow_incomplete_drafts options too. For example, to let editors skip the preview for a quick fix:

yaml
publish_mode:
  type: preview
  direct_publish: true
toml
[publish_mode]
type = "preview"
direct_publish = true
json
{
  "publish_mode": {
    "type": "preview",
    "direct_publish": true
  }
}
js
{
  publish_mode: {
    type: 'preview',
    direct_publish: true,
  },
}

How It Works ​

Preview Workflow is Editorial Workflow with a single stage, Draft, so everything described under How It Works for Editorial Workflow applies, including the checks made before publishing. The differences are:

  • An entry can be published as soon as it’s saved, with the Publish Entry button in the entry editor or on the Drafts page.
  • The entry editor shows a Draft badge rather than a status menu, and the CMS doesn’t ask to send a saved entry for review.
  • The Editorial Workflow page is called Drafts, and lays the unpublished entries out in a single column. If another collection uses Editorial Workflow with more than one stage, the page is a board with a column for each stage again, and an Open Authoring contributor always gets the board.
  • Every pull request counts as a draft, whatever its label says. One labeled In Review or Ready by Editorial Workflow, by Decap CMS or by hand can be published straight away, and its label is left alone.

Pull requests are labeled sveltia-cms/draft and kept as draft pull requests, which the Git service won’t merge. Publishing an entry therefore marks its pull request ready first, relabeling it sveltia-cms/pending_publish, and then merges it. If the merge fails, the entry stays unpublished with the new label.

Switching between Preview Workflow and Editorial Workflow keeps every unpublished entry. Deleting a published entry opens a pull request that removes it, as with Editorial Workflow.

Required Fields ​

A draft can be saved with its required fields left empty, but they have to be filled in before the entry is published. See Required Fields for details, including how to turn this off.

Open Authoring ​

Open Authoring works with Preview Workflow as well. A contributor working on a fork still sends their entry for review when it’s ready, as they can’t publish it themselves. A maintainer then sees it as a draft that can be published right away.