Content can be published in a variety of ways in Sitecore (Publishing Wizard, via the ribbon, via workflow, per item, etc.). This affords Content Authors and Editors great flexibility in getting content to the web, but it is important to remember that all publishing (out of the box, anyway) is governed by a few basic rules and concepts, including one big one: the order that items get published matters. A lot.
Because Sitecore’s default publishing options are well-configured, most users never have to think about this rule. Once publishing gets customized, however, it’s important to keep the following points in mind about publishing order.
Meet the Parents
Almost all items in Sitecore have a parent-child relationship. When publishing a new child item individually, the associated parent item must be published first.
In the above content tree, the “About” page must be published before the “Mission,” “Contact Us,” or “Locations” pages. Attempting to publish either of the children pages first will result in a silent error and nothing being published to the Web database.
Publishing Related Content
There are a couple of settings that affect how related items get published, with the most visible being:
- Publish Related Items – publishes an item’s clones, related media, aliases, and most importantly, all items referencing or being referenced via the Links Database.
- Publish Subitems – publishes all child items (and further descendants) of a parent item.
“Publish Subitems” is pretty obvious, but “Publish Related Items” is worth an explanation (with respect to publishing order and item datasources). Similar to the parent-child relationship, datasource items must be published alongside the items that reference them. Data templates are the heart of all content design in Sitecore, and these need to be published alongside the items that utilize them. Media items attached to content – either pages or datasource items – also need to be published. “Publish Related Items” captures all these different items in one publish operation.
Item Order in the Workbox
If the Workbox is being used to publish content item-by-item, remember that content may be listed in a different order than other related items (parent-child relationships, datasource references, or templates).
Continuing with the example above, here’s our four items in the Workbox:
Notice that all three child pages come before the About (parent) page. If Editors are going to approve individual items from this interface, they must know to publish the parent items first, which is a very difficult task when presented in a flat list. Simply going down this list, “Mission,” “Locations,” and “Contact Us” would try to be published without the parent item “About,” thus all three would fail (in the event that “Publish Related Items” is turned off at this point).
A Few Tips for Publishing
To keep publishing from going haywire, keep these tips in mind:
- Ensure “Publish Related Items” is enabled whenever it makes sense for content editors and approvers.
- Configure and use workflow to ensure items are in the proper state for publishing – especially related content such as media or datasource content.
- Publish in batch, not item-by-item (“site” publish versus “item” publish).
- Use the Workbox to publish items in batch by workflow state.