Skip to main content

Working with hierarchies

Hierarchies are tree structures of content items that can be used to represent everything from product categories, to store locations or site navigation. We've made it easy to work with hierarchies in Dynamic Content and you create and edit hierarchies in the same way that you work with other content, with a few differences.

For a technical introduction to hierarchies, see the Developer guide to hierarchies.

Creating a hierarchy
Link copied!

You create a hierarchy the same way as you do any other content item, by choosing "Create content" in the content library and choosing a content type. The only difference is that the content type you choose will be set up to make the content item part of a hierarchy.

In this example, we'll create the hierarchy for a site menu. This is created from a content type called "Site menu item".

Choosing the content type from which to create a hierarchy

The content form opens. You'll notice two differences from a standard content form: the "Hierarchy" label is shown in the top left of the window and the form is divided into two, with an edit text box shown on the left and a normal content form, with all its properties, shown on the right.

The hierarchy is shown as a tree of nodes. The first node we enter is the root node, the one from which all other nodes descend. We'll add the label for this node "Site menu".

The top node in the hierarchy is the root node from which all other items descend

The rest of the content item properties can be added as normal. In this simple example we're just including the menu item's name and description. We'll keep the label and the title the same, but they don't have to be.

Adding the rest of the content item properties

When you've finished entering all the fields click "Save". For a content item that is part of a hierarchy, the label must be entered and you won't be able to save if you leave the label box empty. The label will be used for the content item name.

Saving the content item. The item name is used as the node label name

The content item is now saved and you can see that it has content item properties just like any other content item. You can now add child items to this node.

The content item is now saved and items can be added to the hierarchy

Adding an item to a hierarchy
Link copied!

To add an item to a hierarchy you add a child to an existing item. We currently have just one node, the "Site menu" root node. Right-clicking any node will show a menu of options, including adding a child node. Choose the "Add child node" menu item.

Adding an item to the hierarchy

Give the item a label and fill in its properties. In this case we want to represent the "Womens" area of our site.

Setting the item label

When the item is saved, the node labelled "Women" is added as a child to the root node.

The item is added as a child of the Website menu node

We can now add "sibling" items at the same level, or add a child item to the women's section. Clicking the "+" icon to the right of a node is quick way to add children. We'll add "shoes" and "clothing".

Clicking any of the nodes in the hierarchy will open the content item, making it easy for you to traverse the tree.

Clicking the + icon is a quick way to add a child item to its parent

Adding an existing node to a hierarchy
Link copied!

You can add an existing item to a hierarchy, but the item you choose to add cannot already be part of a hierarchy. This means that you can add any item that does not already have a parent.

In this example we've created a hierarchy for the "Electricals" section of a website and we want to add this to the website menu hierarchy.

The electricals hierarchy

To add an existing item, open the parent item, then click the ellipsis (...) of the parent node where the new item will be added and select "Add existing node". Here, we want to add the "Electricals" item to the top level of the hierarchy, so we'll choose the root node "Website menu" as its parent.

Choosing to add an existing node

The content browser opens showing items that can be added to this hierarchy. We'll choose "Electricals". Adding the electricals hierarchy

Note, items that need converting can't be added to a hierarchy. See Converting existing items for use with hierarchies.

All of the descendants of the "Electricals" item are now added to the hierarchy.

Electricals and all its child items are added to the hierarchy

Note that if we'd tried to add "Personal care" or "Razors" to the hierarchy we would get an error, because these items are already children of "Electricals".

Renaming a node
Link copied!

To change a node's label, right click and choose "rename" from the menu.

Choosing to rename an item in the hierarchy

Enter the new label and click "Ok". The content item name is updated and the node label will change.

Renaming the item will change its label and the content item name

Moving a node
Link copied!

You can drag items from one parent to another within a hierarchy.

In the image shown below, the "Bathroom" node is dragged from the "Home" parent to become a child of "Clearance".

Dragging a node from one parent to another

Removing a node
Link copied!

You can also remove a node from a hierarchy. Removing a node does not delete the content item that it represents, it just removes the content item from the hierarchy. To remove a node, choose its parent node and select "Remove node" from the menu. In this example we want to remove "Special offers" from the hierarchy.

When you remove a node, any descendants will be removed as well.

Choosing an item to remove from the hierarchy

A message is displayed warning you that this node, and all its descendants, will be removed from the hierarchy. Click "Ok" to proceed.

You will be warned that all child items will be removed too

The "Special offer" node has now been removed.

The node is removed from the tree

Publishing a hierarchy
Link copied!

You publish hierarchies in the same way as any other content item and you can choose to publish a single node, all of the hierarchy or just a part of it.

To publish a node, right click and choose "Publish" from the menu.

Choosing to publish an item in the hierarchy. In this case we're publishing the Website menu item and all its children

You will be asked if you want to publish just the node itself, or all of its descendants. We chose to publish the root node, so if we choose to publish all of its descendants, then the entire hierarchy will be published. For this example we'll choose to publish all descendants.

You will be warned that all descendants of the item will be published

All of the content items in the hierarchy are now published.

The item and its children are now published

Unpublishing hierarchy nodes
Link copied!

You can unpublish the root node of a hierarchy, but not the child nodes which remain published in case they are used in other places.

Viewing hierarchy items in the content library
Link copied!

The content items that are part of a hierarchy can be viewed, filtered and organized in the same way as other content items. In the image below you can see two items: the website menu root node content item and the "Special offers" node that we removed from the hierarchy. The child content items are hidden by default because the "Hierarchy child nodes" setting is turned off. If we turn this option on, then all of the child items will be shown.

Showing hierarchical child nodes is off so only the root node content items are shown in the Content Library

All of the content items that are part of the hierarchy are now shown.

All the content items that are part of the hierarchy are shown

Converting existing items for use with hierarchies
Link copied!

If a content item's type is updated from being non-hierarchical to hierarchical after the item was created, the item must be converted before you can add it to a hierarchy.

To convert an item for use with hierarchies, open it from the content library. The item is opened in the content form, overlaid with the "Convert item to hierarchy" dialog. To continue you must convert the item.

The Convert item to hierarchy dialog

When an item is converted it retains all of its field information, and a new version of the item is created.

If you convert a published item you will need to republish it after converting.

Note, if you try to restore to a version of content that was created before an item was converted, you will be prompted to convert the earlier version. See Viewing content revision history

Developer info:

If you update a schema content type with the trait:hierarchy object, all existing content items for that schema will need to be converted before the items can be added to a hierarchy. See Developer guide - The hierarchy trait.