Skip to main content

Microsoft

Sitecore – Unrelated Items Publish When Publishing Item

Colleague Bill Cacy and I have been actively working with Sitecore recently on an issue that has been affecting one of our clients. When publishing a single item in the content tree with Publish related items checked, seemingly unrelated items, all the way up to the Home item, are being published as well.

The issue occurs when a user selects to Publish item from Sitecore and checks the Publish related items option. As Dmytro Shevchenko explains on Stack Exchange, the Publish related items option should trigger the following to be published with the current item:

  • The item’s clones (by the AddItemCloneReferences processor);
  • The media used by the item (by processors AddFileDropAreaMediaReferences and AddItemLinkReferences);
  • All items the published item links to (by the AddItemLinkReferences processor).
  • The item’s aliases (by the AddItemAliasReferences processor).

All of these are expected. However, we have noticed that the ancestors of the item being published are also being published, even though they are in no way linked to publishing item, and meet none of the criteria above. Consider this simple Content Tree on a clean Sitecore install:

  • sitecore
    • content
      • Home
        • About
        • Help
          • FAQ

All items created using the Sample Item template provided out of the box. No items have a data source set. Publishing any single item in the tree with Publish related items checked causes no issue–only that item is published.
However, pointing the Data Source of one of the items’ renderings to another item will trigger the Data Source‘s ancestors to be published as well:

  1. Update the Data Source of the Sample Sublayout rendering on the About item to point to the About item.
  2. Update the Title field on the Home and About items, and save.
  3. Publish just the About item, with Publish related items checked.
  4. Both Home and About will be published.

In this case Home should have not been published. About only links to itself through its Sample Sublayout Data Source.
Another example, but more far reaching:

  1. Update the Data Source of the Sample Sublayout rendering on the About item to point to the FAQ item.
  2. Update the Title field on the Home, About, Help, and FAQ items, and save.
  3. Publish just the About item, with Publish related items checked.
  4. Home, About, Help, and FAQ will be published.

In this case only About and FAQ should have been published–About was the publish target, and its Sample Sublayout Data Source links to FAQ. However, both of FAQ‘s ancestors, Help and Home, are published as well.
This issue does not seem to affect items that are in workflow. That is, an item that has a new version in Draft state, for example, will not be published through this issue.
Sitecore’s support team has been awesome and super responsive so far. They have narrowed the issue down to the Sitecore.Publishing.Pipelines.GetItemReferences.AddItemLinkReferences processor in the getItemReferences pipeline. I’ve confirmed that the issue affects Sitecore 8.0 initial release all the way up to Sitecore 8.2.
The issue has been raised as a bug with Sitecore and can be tracked with reference number 131687. Sitecore has released a patch on their Sitecore Support GitHub account, and you can download it here: https://github.com/SitecoreSupport/Sitecore.Support.131687/releases.

Thoughts on “Sitecore – Unrelated Items Publish When Publishing Item”

  1. The patch is no longer publicly available, please request it via normal support procedure.

Leave a Reply

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

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Corey Smith, Sitecore MVP & Lead Technical Consultant

I'm a Sitecore MVP and Lead Technical Consultant at Perficient focusing on Sitecore and custom .NET development.

More from this Author

Categories
Follow Us