Deep dive to Content Availability feature in Publishing Service

There is an excellent article about Publishing Services and how to make it running by @mikaelnet. In my post will explain what Content Availability is and how to verify if this feature works properly.

What is Content Availability (CA)?

The content availability feature ensures that the valid version of an item is always available in the target database at the time of publishing. In this way, you do not have to perform a publishing operation every time an item version expires and the next version should be displayed.

Source: Sitecore Publishing Service Installation and Configuration Guide

What does it mean in a practice?

Introduction Content Availability is a historical moment because, in the first time in the long Sitecore history, we can have more than one item version in the web database. When you enable content availability and publish an item, the currently valid item version and all the versions that are valid for future publishing are moved from the source database to the target database. A new pipeline that is enabled in the content availability configuration file automatically clears the Sitecore item cache when an item version expires and then, when a contact accesses the item, the next valid version is displayed

Whaaaaaaaaaaaaaaaat? Three versions of the item in the web database?

Content autor need to define a date and time when each version should be published and publish item.

Publish Viewer – shows the visibility timeline for each version and for item.

If everything works well, then the content author can sleep and on the proper time, the appropriate version of the item should be presented to the end-user.
If you want to know what might go wrong, you need to read on.

How Content Availablity is implemented?

The Content Availability feature base on index fields my friend. When an item is indexed the computed fields below stores the valid inception and expiry dates for each version. When a query is issued to content search then the isAvailable flag is checked to ensure the hiding and display of the valid versions in a search context that matches the behavior of the Item API. The content availability functionality adds the following new computed fields:

  • versionsunrisedate
  • versionsunsetdate
  • publishablefrom
  • publishableto

And one virtual field isAvailable.

In the pictures below, I showed how data from the user interface moves to data in the index.

Fields publishablefrom and publishable to are connected with the item visibility. Below you can see how user interface is mapped to the index fields.

Fields versionsunrisedate and versionsunsetdate are used to configure a item version visibility.

Issues number one.

These four fields can have wrong values, becasue of bug in Publishing Module that was registered with reference number #310787, and is avaliable on GitHub

The second issue was registered with reference number #310786, and must be applied to Publishing Service, and is avaliable on GitHub

Have to check first release notes for Publishing Service to verify if these two bugs are fixed in the version used by you.

Still don’t see changes on CD?

Content Availability feature is disabled by default. I guess that you read Publishing Service installation manual and enable Content Availability feature on CM, CD and Publishing Service.

By default file Sitecore.Publishing.Service.ContentAvailability.config contains only configuration for a website.

Sitecore.Publishing.Service.ContentAvailability.config

Attribute filteredItems is configured per site please verify if you add this attribute to your site. The best way to verify it is to use <hostname>/sitecore/admin/showconfig.aspx. But wait, you said Contend Delivery server. No worries @RobsonAutomator have a small present for you – showconfig.cshtml that works on CD when will be run locally on the server

Showconfig.cshtml is your secret weapon

The worst thing left at the end.

Important If you are using HTML caching on a rendering, the Sitecore item cache does not automatically clear. In addition, if you use a data source inside a rendering, and if the data source item switches to display a new version, the hosting rendering is not updated because there is nothing that indicates that an update of a dependant data source has been triggered.

Source: Sitecore Publishing Service Installation and Configuration Guide

If you miss this part of release notes or documentation no worries, wait for the next post.
I will show you how we implemented ClearHtml and ClearAkamai cache with Publishing Service and Content Availability feature.