Updated
Februar 10, 2021

Post relationships are connections between different posts. When displaying a post, you can easily display any information from posts related to it.

Building a site using post relationships allows you to separate information into independent pieces. Changes you make on a post will reflect on posts in a relationship with it.

For example, when displaying a Recipe post, you can display custom information about its related Equipment post, like name, image, link, etc. If you change the name of the Equipment, the Recipe that uses it will automatically show a new name.

There are three types of relationships that you can create with Toolset:

  • One-to-one
  • One-to-many
  • Many-to-many

One-to-one relationship

In a one-to-one relationship, the connection is possible between a single post of post type A and a single post of post type B. The same applies the other way around.

For example, we have a site where each Recipe can have only one Video with instructions. At the same time, we also want that Video to link only to the one specific Recipe.

Example of the one-to-one relationship
Example of a one-to-one relationship

One-to-many relationship

In a one-to-many relationship, the connection is possible between a single post of post type A and many posts of post type B. At the same time, you can connect a single post of type B to only one post of type A.

For example, we have posts for Kinds of foods. Each Kind of food has many Recipes. At the same time, one Recipe can belong only to one Kind of food.

Example of the one-to-many relationship
Example of a one-to-many relationship

Many-to-many relationship

In a many-to-many relationship, the connection is possible between many posts of post type A and many posts of post type B.

For example, we have posts for our cooking Equipment. We also have our Recipes. When preparing a Recipe, we want to use more than one piece of an Equipment. We can also use that same Equipment for making many Recipes.

Example of the many-to-many relationship
Example of a many-to-many relationship