Sitecore Items: Living Exclusively on the CD Server

KrisLutzHeadshot
Senior Developer
  • Twitter
  • LinkedIn

In the Sitecore world, we usually think of content originating on the Content Management (CM) server and flowing down to the Content Delivery (CD). But what if you need items to exist only on your CD environment? More often than not, this requirement would point to a problem with the design. On occasion, however, there may be a valid reason for this approach.

Recently, I encountered a situation where it was necessary to update a field on specific Sitecore content items the first time the item was loaded on a page. This value needed to be persistent, ensuring that a publish action would not alter or remove the item.

The Problem with this scenario is that if the item remains on CM the value that was set on CD would get overwritten on publish. Conversely, if the item is removed from CM, it will also be removed from the CD on publish. Setting publishing restrictions introduces similar challenges.

The solution presented itself in a little know config setting in Sitecore Publishing Service. Something I was not able to find in the Publishing Service documentation. 

In the configuration folder for your publishing service, you will find a file called sc.publishing.OrphanedItems.IgnoredItemsAndTemplates.disabled.

The full path would likely be:

<SitecorePublishingServiceRoot>\Sitecore\Sitecore.Framework.Plugin.Publishing\Config\sc.publishing.OrphanedItems.IgnoredItemsAndTemplates

In this file you will see a section as follows:

Items Living Excuslively on the CD

IgnoreChildrenOfItemIds – Will not delete/remove any items under the provided ID even though they are removed from the CM.
IgnoreTemplateIds – Will not delete any items using the specified template ID even though they are removed from the CM

It is important to note that if the item exists in the Content Management (CM) system, any updates made in CM will publish out to the Content Delivery (CD) server. As soon as the item is removed from the CM, the item will continue to exist on CD only. This enabled you to create the items on CM, publish them out, enable the config, and delete the items from the CM Server while having them remain on the CD server.