Add a Publish Rule
Adding a publish rule lets you define approval or workflow requirements before entries can be published or unpublished. This ensures compliance and quality by enforcing organizational standards requiring each entry to meet the designated workflow stage before it can be published or unpublished.
Note: Only the stack owner, admin, or developer can add a publish rule.
Setting up publish rules within a workflow is optional. However, because publishing and unpublishing are critical to content operations, publish rules are managed within the Workflows feature.
To add a publish rule in your stack, log in to your Contentstack account and perform the following steps:
- Go to your stack and click the “Settings” icon or use the shortcut key “S” (for both Windows and Mac users).
- Select Workflows and go to the Publish Rules tab.
- Click + New Publish Rule.
- On the Rule Details page:
- Branch(es): Select one or more branches to apply the rule.
Tip: You can select multiple branches.
- Content Types:
- All Content Types: Apply the rule globally.
- Specific Content Type(s): Select one or more types from the dropdown.
Note: You cannot add more than one rule to the same content type.
- Languages:
- All Languages: Apply the rule to all languages.
- Specific Language(s): Choose desired languages from the dropdown.
- Environments: Select the environment(s) for which the rule applies (e.g., Production or Staging).
- Actions: Choose whether this rule applies to Publish, Unpublish, or All (both actions).
Note: All parameters are required fields.
- Branch(es): Select one or more branches to apply the rule.
- Expand the Conditions section (if not expanded by default). You must define at least one condition.
- Approver: Add one or more users or roles who must approve before publishing or unpublishing.
- Workflow Stage: Specify the workflow stage (e.g., Final Review or Legal Approved) that an entry must reach before it can be published or unpublished.
- Enable Prevent self-approval to ensure independent validation:
- The last editor cannot approve or publish the entry.
- Two distinct users must approve before publishing or unpublishing.
- If only one user is assigned, the system displays a validation prompt asking you to add an additional approver.
Tip: Enable this option to maintain separation of duties between content creators and reviewers, ensuring independent review and accountability in workflows.
- After completing all required fields and conditions, click Save.
This creates a publish rule that governs publishing and unpublishing actions based on the selected parameters and conditions within your defined workflow.
Note:
- Publish rules apply only to unpublished versions of an entry.
- Once an entry version meets the rule conditions and is published to an environment, it can be republished to the same environment without restriction, even if it moves to a different stage.
- To re-trigger rule validation, the entry must be modified to create a new version.
This approach streamlines publishing across locales and environments by eliminating redundant approvals, reducing delays, and ensuring timely content distribution.
Example Scenario
Your team creates a blog post titled “Holiday Sale Preview.” The publish rule requires Legal approval and that the entry reaches the Final Review stage before it can be published.
- When the post is first published, it’s routed for approval and validated against the required workflow stage.
- If a content manager republishes the same version in a different environment, the rule isn’t triggered again since the version already met the required conditions.
- If the post is edited (e.g., updating prices or images), a new version is created. The rule is enforced again, requiring fresh approval and workflow validation.
API Reference
To add a publish rule via API, refer to the Create publish rules API request.
More articles in "Set up Publish Rules"
