Learn / eZ Publish / Cross Publishing Content in eZ Publish

Cross Publishing Content in eZ Publish

This article is the sixth in a series focusing on concepts and features discussed in the newly released book eZ Publish Content Management Basics and is a short editors' user guide to the cross publishing feature.

With cross publishing, you can avoid inconsistent duplicates of content that are hard to maintain. If content appears at multiple locations, you only have to edit the object once - the changes will be reflected at all locations. This is in contrast to copying content to another location, where changes made at one location are not reflected at other locations.

The target audience for this article includes all eZ Publish content editors working with cross publishing through either the Website Interface or the Administration Interface. Readers can review the layout and access requirements for the Administration Interface and Website Interface from the previous articles in this series. For a review of basic eZ Publish concepts, see the first article from this series.

Cross publishing through the Website Interface requires version 1.2 and above of the ezwebin package, which comes with eZ Publish 3.9.2 installations and higher.

Content objects, nodes and the content hierarchy

Cross publishing is based on the mapping between content objects and nodes within the content hierarchy (also called the node tree). Recall from the first article in this series that content objects are wrapped inside (or encapsulated) and structured using content nodes (or just "nodes" for short). The following illustration shows a simplified example of a node and its encapsulated object as it is represented inside the system.

Object - node relation

Nodes are organized in a node tree, storing all published content in a hierarchy. A node provides a location for a content object within the tree structure, and refers to exactly one content object. However, an object can be referenced by several nodes, thereby appearing at multiple places in the node tree. The following illustrations show an example of a structure where an object (with an ID of 31) has multiple locations in the tree.

Objects, nodes and the content node tree - multiple locations

Content node tree with multiple locations

Main and secondary locations

When an object has multiple locations (and is thus associated with more than one node), only one node can be considered the main node of the object. The main node usually represents the object's original location in the tree - where it was first put. The other nodes can be thought of as additional or secondary nodes (or locations). Among other things, the main node is used to avoid duplicate search hits; a search result returns only main nodes.

The cross publishing feature only works with single nodes. If you add a new location for a folder that contains sub items (such as several news articles), the system will only make a new location for the folder itself - not the sub items. In other words, adding a location to a content object does not add locations to its children. Because of this, cross publishing is mainly used to add locations to standalone content such as articles, images and information pages.

The Locations window of the Administration Interface is used for managing content locations and cross publishing in the advanced back-end of your site. Recall from the fourth article in this series that the Locations window is accessed by enabling the corresponding switch at the top of the main area when viewing content. When enabled, the Locations window reveals the different nodes / locations that are associated with an object:

Locations window

The currently selected node is displayed using bold characters. The location itself, shown as the actual node path, can be used to access higher nodes in the content hierarchy. The radio button on the right indicates whether the node is the main node. If the content object is published at only one location, this will always be the main location. It is possible to add and remove locations using the Add locations and Delete selected buttons. The Set main button is used to change the main node.

Adding a location using the Administration Interface

To publish a piece of content to an additional location from the Administration Interface, navigate to the desired content and enable the Locations window. Click the Add locations button, then use the Browse interface to select another location at which to publish the object. Navigate by clicking on the listed content names until you get to the location where you want to publish the content. To navigate upwards in the node tree, click the arrow in the top left corner of that window. When you have found the new location, check the corresponding box and click the Select button.

You can also select multiple locations for a newly created object before it is published. In this way, the content will appear at all the desired locations once it is published. For example, you could publish an article about some product release on the front page, in the Webshop, in the information pages for the community and in the company bulletin pages all at the same time. The Object Edit Interface (see the fifth article in this series for a description of this interface) contains a special version of the Locations window at the bottom:

Locations window of the Object Edit Interface

If this window is not available, go to the My account tab and look at the Edit mode settings window at the bottom of the left column. Make sure that "on" is highlighted for "Locations".

Adding a location using the Website Interface

To publish a piece of content to an additional location from the front-end of your site (assuming you are logged in to the Website Interface with at least Editor user privileges), navigate to the desired page and click the Add location button on the Website Toolbar:

Website Toolbar, Add location button

After clicking the button, the top level of your content hierarchy is displayed. As detailed previously for the Administration Interface, navigate by clicking on the listed content names until you get to the location where you want to publish the content. To navigate upwards in the node tree, click the arrow in the top left corner of that window. When you have found the new location, check the corresponding box and click the Select button:

Select location for cross publishing

Removing a location using the Administration Interface

To remove a secondary location from a content object, make sure that you are viewing the content object and the Locations window is enabled. Mark the checkbox to the left of a location, then click the Delete selected button. Note that the checkbox associated with the main location cannot be selected. For structural reasons, you are not permitted to delete the main location of a content object. If you want to delete the main location and keep the other location(s), first set the main location to one of the other locations. Do this with care!

If the location to be deleted has sub items, you will be presented with a confirmation page warning you about which additional nodes will be removed.

Removing a location using the Website Interface

You can remove existing locations by clicking the Remove button on the Website Toolbar when viewing the content you wish to remove. However, it is not possible to view all locations for some content in the Website Interface, and you cannot be sure whether it is a main or secondary location that you are viewing. Because of this, we strongly recommend that you carry out location removal through the Administration Interface.

Cross publishing is based on the mapping between content objects and nodes within the content hierarchy (also called the "node tree"). It enables you to have the same content appear at multiple locations on your site and to keep content consistent across locations.

The Locations window of the Administration Interface is used for managing content locations and cross publishing in the advanced back-end of eZ Publish. In the Website Interface, the Add location button on the Website Toolbar is used for cross publishing content.

Resources