Starting from Sitecore 7.2, there is an option to publish an item with "Publish related items" checked. If you do that, the
<getItemReferences> pipeline (defined in Sitecore.config) will be executed to get additional items that are then added to the publishing queue. By default, it returns the following items related to the item being published:
- The item's clones (by the
- The media used by the item (by processors
- All items the published item links to (by the
- The item's aliases (by the
If you wish, you can extend this pipeline by adding your custom "related items" logic as a new processor.
The link database needs to be up-to-date in order for this feature to work correctly. So if you have problems with publishing related items, try to rebuild the links DB.
Items specified as the data source of a rendering component will also be treated as "related". This is possible because they are also stored in the link database (at least, in the latest versions of Sitecore). Keep in mind that the link database will only contain data source items that are specified directly (e.g. using a path or an item ID). Query-based data sources will not update the link database, and hence, such items will not be published using "Publish related items".
As an example, this feature may be useful when you are publishing a new page, and you want to make sure that all resources used by that page are also published.
Publishing related items is only available during an item-level publish, and not during a site-level publish.
- Related items of related items will not be published. This may cause some confusion—see this question for an example.
- When you publish both the subitems and the related items, then all related items of all subitems will also be published. This may significantly increase the amount of items added to the publishing queue, so be mindful of this behavior.