In my previous post we used the example of a film to show you how to create a simple content type. In this post I'll outline how we can create relationships between two content types to build a simple content model, and make your content easy to reuse.

We'll continue along the theme of films and introduce the cast and crew.

Extend the existing content type

One way we could add the cast and crew would be to extend the existing film content type. Adding additional text fields to the content type would allow an author to supply key cast and crew members, but this could severely reduce the reuse and flexibility of the content. Lets look at some reasons why.

Limitations of adding static fields

  • You would have to predefine a set number of actor text fields, e.g. 5, but what happens when you need to add 6 actors?
  • An author would have to manually type the name of each actor, leading to potential spelling mistakes and duplication.
  • Using a comma-separated list in a text field would allow you to add multiple people, but this method this is prone to error.
  • What if an actor appears in multiple films? This is another situation where an author is likely to introduce spelling inconsistencies between different films.
  • It provides no way to extend an actor / crew member's details at a later date, e.g. biography, date of birth and place of birth.

A better way, make content flexible

If you have a type of content that has the potential to be extended, then its a good idea to create a new content type. This ensures that your content remains as flexible as possible and ready for reuse. Combining the content types by creating a content type relationship extends the basic content model we saw in my last post.

In our example both cast and crew are people defined by a particular role in a film. So, we'll create a content type called people that we can then relate to specific roles in our film content type.

People content type

A screenshot of the content type builder with the fields for a person added

We'll include the following fields in the content type:

NameTypeDescription
Name Text The name of the film.
Biography Text (Multiline) A short biography for the individual.
Date of birth Date The date that the individual was born.

Connecting people to their roles

Now we have two content types, we need to create a relationship between the people and their relevant roles in the film.

A simple table diagram describing the relationship of cast members of a film to a person content type

We can use the entry field type to create this relationship. The entry field editor allows single or multiple entries to be selected from a content type, allowing an author to create a relationship between two different sets of content.

An animation showing how to add an entry field to a content type

Adding multiple cast members to a film

For the purposes of this post I've created a couple of example cast members by creating new entries against the people content type.

Once the relationship is in place an author can easily select people using the autosuggest search box when populating the entry.

An animation showing a film entry being populated and selecting cast from the people content type

Summary

Using a new content type and setting up a relationship creates content flexibility. New people can be added centrally, updates can be made to their information, and people can be assigned to multiple roles or used in other content types by creating new relationships.

Breaking your content down into smaller chunks is fundamental to making your content easy to reuse and manage across your websites or applications.

Signup to the Contensis BETA and build your own

If you are already a user of Contensis, you can have a go at creating your own content models for your organisation in Contensis 9 by signing up to our BETA.

Subscribe to our stories

Richard Saunders

About the Author

Richard is the product owner for Contensis – our CMS. He sets the direction and roadmap for the product. His background includes both user experience and front-end design.

Follow Richard

More stories from Zengenti