Sitecore Is Publishing Items in Draft Stage.

The Problem

After upgrading the client’s instance from version 9.3 to 10.2, we faced a bug where items in a Draft Stage were being published to the Web database and it was not desired by the client.

The process used to be as follows: a Content Editor created a new item, tried to publish it, and it got published.

Before we dive into the specifics of the bug, let’s first understand the workflow states in Sitecore. Sitecore offers a flexible workflow system that allows you to define various stages in the content creation and publishing process. By default, Sitecore has three workflow states: Draft, Awaiting Approval, and Published. When you create an item in the Content Tree, it is initially in the Draft state. Once you have finished editing the item, you can submit it for approval, which will move it to the Awaiting Approval state. If the item is approved, it will move to the Published state, and the changes will be reflected on the website.

The Solution

After thoroughly investigating the bug, I discovered the “PublishEmptyItems” parameter which, by default, is set up as false in the <Sitecore.config>.

This parameter determines whether items without any version can be published to the Web database. If set to true, Sitecore will publish items in the Editing Stage, even if they are empty. However, as you have noticed, this behavior is not desirable, as items in the Editing Stage should not be published to the Web database.

Then I figured out that other 2 configs were setting this parameter to True. This parameter has been around for several years in the client’s instance and has remained in Sitecore XP 10.2 as well. It was originally set up in a legacy version of Sitecore. However, this behavior is not desirable in most cases, as items in the Editing Stage should not be published to the Web database until they are approved. Therefore, if you encounter this bug in your instance, it’s essential to understand the ‘PublishEmptyItems’ parameter and how to configure it properly.”

To fix this issue, you had to set the “PublishEmptyItems” parameter to false. If you’re not sure what config is doing it, just go to <https://your-website/sitecore/admin/showconfig.aspx> and look for this parameter. Find the config file and change it.

By doing so, you ensured that items in the Editing Stage would not be published to the Web database, even if they were empty.

Other solutions

If the above solution didn’t fix your problem, you have to review the Workflow item (/sitecore/system/Workflows) and the Publishing Targets (/sitecore/system/Publishing targets). Ensure both are properly set.

Also, take a look at the official doc and other discussions:

Thanks!

Leave a Reply

Your email address will not be published. Required fields are marked *