Hierarchies

What are hierarchies?

Hierarchies allow you to model tree structures of content. A hierarchy is a natural way of using a tree structure to represent the relationship between objects. It might be a page structure for a website, a list of worldwide store locations organised by country and city, a structured list of product content, app settings or a list of ingredients and meal types for a recipe site. Hierarchies lend themselves to many use cases.

How do I use hierarchies?

In Dynamic Content, a hierarchy provides a new way to link content items together. The content items in a hierarchy are normal content items that have relationships to each other. Because they are normal content items, you can work with these content items independently and manage and publish items in the normal way. The main difference is that a content item that is part of a hierarchy will have a relationship with its parent.

On this page we'll provide an overview of the main features and benefits of using hierarchies and include a few of the many possible use cases.

For more details about defining and using hierarchies see our developing with hierarchies page.

Consuming hierarchies in your app

Without using hierarchies, you could choose to model structures such as menus using normal content links or content references, but traversing the tree programmatically would require additional code and you'd need to either load in the entire tree structure at once, or request each item one at a time.

If you use hierarchies, then you can traverse the tree using the content id of each item's parent, and the filter API makes it easier to list all or part of a hierarchy, so you can easily fetch those parts of a tree you want to work with.

Hierarchies can also be used with Amplience Search, particularly useful for those cases where you want to classify content dynamically.

A user interface designed for hierarchies

We've designed a user interface for working with hierarchies, so it's easy for users to add and remove items, navigate to particular nodes, and publish all or part of the hierarchy. Because hierarchies provide a great way to navigate around structured content, you might also use them for tags or other structures that can be represented as a tree.

When you click on a node in the tree, the content form will be shown on the right and you can edit the content item as normal. This makes it easy to edit each content item in the hierarchy.

The hierarchy user interface
The hierarchy user interface

You can control the order in which items are sorted in a hierarchy and drag items from one parent to another. You might also choose to give the user more control over the sort order, by sorting using a user defined field such as "ranking", for example.

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
Dragging a node from one parent to another

It's also possible to remove a node from one part of a hierarchy and then add it and all its children to another hierarchy.

Example use case: site navigation

The example below shows one possible use case, a website menu that's built from a hierarchy. On the left you can see the hierarchy as modelled in Dynamic Content. Users can see at a glance how the website is structured and where content should be displayed. On the right is how the hierarchy is consumed in the app, providing the structure for the site navigation.

An example use case: a site menu
An example use case: a site menu

Hierarchies let users see the whole context. It might be a page or website layout, a buyer's guide or a list of tags to apply to blog posts. The user interface makes it easy to see all of the tree, and decide where to add and remove nodes if they need to.

Hierarchies can contain multiple content types

The simplest hierarchies contain just one content type, but often your use case will require multiple content types.

The example below shows a buyer's guide section website for a website. It's organized into categories within which are articles. The category content type might just contain an image and a brief description, while the article would be another content type such as a blog.

By using a hierarchy the user is given control over the structure of each section and where each guide is shown.

An example use case of a hierarchy used to model the buyer's guide section of a website
An example use case of a hierarchy used to model the buyer's guide section of a website

Using hierarchies to tag content dynamically

Using hierarchies is a good way to put the user in control. Hierarchies can be used to tag content in a dynamic way. So you might want to use a hierarchy to tag blog posts, allowing users to add tags without developers needing to make any changes to the content model. You might also allow content to be tagged with particular sections of a website, so you could dynamically find an appropriate banner to display for "Men's shirts" or "Bathroom lights", for example.

The image below shows the use case of a recipe site. The hierarchy is used to classify recipes by diet, such as vegan or vegetarian, by cooking method, meal type and the recipe author. The user can build up and update the hierarchy. So they could introduce a new diet type or cooking method to classify the recipe.

All of this can be combined with a search index built and managed with Amplience Search that can be used to allow the user to find the most relevant recipes using facets built dynamically from items in the hierarchy.

An example use case showing recipies classified using items in a hierarchy
An example use case showing recipies classified using items in a hierarchy

The hierarchies extension

The hierarchy chooser content field extension makes it easier to select items from a hierarchy. This is particularly useful when choosing items to tag content.

The hierarchies content field extension makes it easier to choose one or more items from a hierarchy to add to a content item
The hierarchies content field extension makes it easier to choose one or more items from a hierarchy to add to a content item

You can find more details about setting up and using the extension on the developing using hierarchies page.

Developing using hierarchies

Using the Filter API

Hierarchies- user guide

Search

results matching ""

    No results matching ""