
Security News
Official Go SDK for MCP in Development, Stable Release Expected in August
The official Go SDK for the Model Context Protocol is in development, with a stable, production-ready release expected by August 2025.
sanity-plugin-workflow
Advanced tools
A demonstration of a custom content publishing workflow using Sanity.
This is a Sanity Studio v3 plugin.
With Sanity Studio you can customize your content tools to support arbitrary workflows like assignment and content pipelines.
This plugin is distributed as an example implementation of customization APIs in the Sanity Studio V3 and is not considered to be a feature-complete implementation of what workflow management requires in production. It is meant as a starting point intended to be forked and customized to the needs of your organization and content creators, or simply as an illustration of what is possible in Sanity Studio V3.
An intentional design choice of this plugin is that it does not influence or modify whether a document is in draft or published. It only tracks the values of a separate "metadata" document. In this implementation, an "Approved" document could be a draft but will still need publishing. "Approving" the document deletes the "metadata" and so removes it from the "Workflow" process. You choose if Publishing the document happens in the Studio like normal, using the Scheduled Publishing plugin or the Scheduling API.
This plugin is considered finished in its current form. Your feedback for workflow features you would like to see in Sanity Studio would be appreciated and can be shared in our Slack community.
This work demonstrates how a single plugin can define:
npm install --save sanity-plugin-workflow
or
yarn add sanity-plugin-workflow
Add it as a plugin in sanity.config.ts (or .js):
import {createConfig} from 'sanity'
import {workflow} from 'sanity-plugin-workflow'
export const createConfig({
// all other settings ...
plugins: [
workflow({
// Required, list of document type names
// schemaTypes: ['article', 'product'],
schemaTypes: [],
// Optional, see below
// states: [],
})
]
})
The plugin comes with a default set of "States". These are tracked by the plugin creating a separate "metadata" document for each document that has begun the Workflow.
Documents can be promoted and demoted in the Workflow with the provided Document Actions as well as a drag-and-drop custom Tool. The settings below are not enforced by the API, custom access control rules could be used to do so.
{
// Required configuration
id: 'inReview',
title: 'In Review',
// Optional settings:
// Used for the color of the Document Badge
color: 'success',
// Will limit document actions and drag-and-drop for only users with these Role
roles: ['publisher', 'administrator'],
// Requires the user to be "assigned" in order to update to this State
requireAssignment: true,
// Requires the document to be valid before being promoted out of this State
// Warning: With many documents in the Kanban view this can negatively impact performance
requireValidation: true,
// Defines which States a document can be moved to from this one
transitions: ['changesRequested', 'approved']
}
A content creator composes a new document of one of the configured Schema types. The document is a "Draft", but not automatically added to the Workflow.
The creator clicks the "Begin Workflow" Document Action to create a new "metadata" document and add the document to the first State in the Workflow. Using the default States, the document is now "In Review".
The document is now visible in the Workflow Tool. The creator can drag and drop the document to the next State in the Workflow, "Changes Requested". Other users may be "assigned" to the document. In the default State configuration, only an assigned user can move the document into the final "Approved" state.
An administrator can move the document into Changes Requested or Approved.
With the document now Approved, a user may also return to the document and Publish it, by whatever means that make sense to your use case. Such as scheduled publishing or migrating it to a new dataset.
Once the Workflow is complete, the metadata can be removed by using the "Complete Workflow" document action.
This plugin is largely based on the original Workflow Demo built into a Sanity Studio v2 project. The major differences are:
MIT © Sanity.io
This plugin uses @sanity/plugin-kit with default configuration for build & watch scripts.
See Testing a plugin in Sanity Studio on how to run this plugin with hot reload in the studio.
Run "CI & Release" workflow. Make sure to select the main branch and check "Release new version".
Semantic release will only release on configured branches, so it is safe to run the release on any branch.
FAQs
A demonstration of a custom content publishing workflow using Sanity.
The npm package sanity-plugin-workflow receives a total of 580 weekly downloads. As such, sanity-plugin-workflow popularity was classified as not popular.
We found that sanity-plugin-workflow demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 2 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
The official Go SDK for the Model Context Protocol is in development, with a stable, production-ready release expected by August 2025.
Security News
New research reveals that LLMs often fake understanding, passing benchmarks but failing to apply concepts or stay internally consistent.
Security News
Django has updated its security policies to reject AI-generated vulnerability reports that include fabricated or unverifiable content.