Draft & Publish
The Draft & Publish feature allows to manage drafts for your content.
Plan: Free feature.
Role & permission: None.
Activation: Available but disabled by default.
Environment: Available in both Development & Production environment.
Configuration
Path to configure the feature: Content Type Builder
For your content types to be managed with Draft & Publish in the Content Manager, the feature must be enabled through the Content-type Builder. Draft & Publish can be configured for each content type.
To enable Draft & Publish:
- Either edit an already created content type of your choice, or create a new content type (see Content Type Builder documentation for more information).
- Go to the Advanced settings tab.
- Tick the Draft & Publish option.
- Click the Finish button.
Usage
With Draft & Publish enabled, the Content Manager's edit view indicates the current status of your content type's entry at the top of the interface. Your content can have 3 statuses:
- Published: The content was previously published. There are no pending draft changes saved.
- Modified: The content was previously published. You made some changes to the draft version and saved these changes, but the changes have not been published yet.
- Draft: The content has never been published yet.
Working with drafts
Path to use the feature: Content Manager, edit view of your content type
While editing a document, you can see 2 tabs:
- The Draft tab is where you can edit your content.
- The Published tab is a read-only tab where edition of all fields is disabled. The Published tab only exists to show what is the content of fields in the published version.
By default, each newly created content is a draft. Drafts can be modified and saved at will, using the Save button in the Entry box on the right side of the interface, until they are ready to be published.
Once you made changes to a draft, you have 3 possible options, all available in the Entry box on the right side of the interface:
- Publish your document (see publishing a draft),
- Save your draft for later retrieval,
- or discard changes, by clicking on and choosing Discard changes.
Publishing a draft
Path to use the feature: Content Manager, edit view of your content type
To publish a draft, click on the Publish button in the Entry box on the right side of the interface.
After a draft is published:
- The content of the Draft and Published tabs should be exactly the same (but the Published tab remains read-only).
- The status, below the document's title, will switch to "Published".
Before publishing a draft, make sure it doesn't have relations with other non-published content, otherwise some of the content may not be available through the API.
When a document has both a draft and a published version available, the published version can be found in the Published tab. If the document has only a draft version, you can not click on the Published tab.
To schedule publication, i.e., convert a draft to a published entry at a given date and time, you can include it in a release and schedule the publication of the release.
Unpublishing content
Path to use the feature: Content Manager, edit view of your content type
To unpublish a previously published content: from the Draft tab, click on in the Entry box on the right side of the interface and choose the Unpublish button.
If the draft version of the document contains content different from the published version, you can decide what to do with both content when unpublishing:
- From the Draft tab, click on in the Entry box on the right side of the interface and choose the Unpublish button.
- In the Confirmation dialog that opens, you can choose to:
- Unpublish and keep last draft, so that all the content you currently have in the Draft tab is preserved, but the all the content from the Published tab is definitely gone
- Unpublish and replace last draft to discard any existing content in the Draft tab and replace it with the content of all fields from the Published tab
- Click Confirm. The desired changes will be applied to both the Draft and Published tabs and the new status of the entry will also be reflected below the entry title.
Bulk actions
Path to use the feature: Content Manager, list view of your content type
Selecting multiple entries from the Content Manager's list view will display additional buttons to publish or unpublish several entries simultaneously. This is what is called "bulk publishing/unpublishing".
If the Internationalization plugin is installed, the bulk publish/unpublish actions only apply to the currently selected locale.
Bulk publishing drafts
To publish several entries at the same time:
- From the list view of the Content Manager, select your entries to publish by ticking the box on the left side of the entries' record.
- Click on the Publish button located above the header of the table.
- In the Publish entries dialog, check the list of selected entries and their status:
- Ready to publish: the entry can be published
- "[field name] is required", "[field name] is too short" or "[field name] is too long": the entry cannot be published because of the issue stated in the red warning message.
- (optional) If some of your entries have a status, click the edit buttons to fix the issues until all entries have the Ready to publish status. Note that you will have to click on the Refresh button to update the Publish entries dialog as you fix the various entries issues.
- Click the Publish button.
- In the confirmation dialog box, confirm your choice by clicking again on the Publish button.
Bulk unpublishing content
To unpublish several entries at the same time:
- From the list view of the Content Manager, select your entries to unpublish by ticking the box on the left side of the entries' record.
- Click on the Unpublish button located above the header of the table.
- In the confirmation dialog box, confirm your choice by clicking again on the Unpublish button.
Usage with APIs
Draft or published content can be requested, created, updated, and deleted using the status
parameter through the various front-end APIs accessible from Strapi's Content API:
REST API
Learn how to use the status parameter with the REST API.
GraphQL API
Learn how to use the status parameter with GraphQL API.
On the back-end server of Strapi, the Document Service API can also be used to interact with localized content: