API: Content Delivery API
View the published or draft content by simply switching between the Deliver and Preview APIs.
Locale: U.S. English
Working with multiple languages? You can query the Content Delivery API for a specific locale.

Table of contents

Content model

Content modelling is the practice of structuring your content. At Contentful, you do this by creating content types. Think of a content type as a schema for bits of content that are similar. For each content type, you populate its fields. Each field represents one piece of data of a specific type.

You can reference one content type from another to define relationships between them.

The content model of this lesson

The text that you're reading now is stored in Contentful. Its content type structure is as follows:

  • Lesson: Used to group and arrange content
  • Lesson > Copy: One chunk of markdown content
  • Lesson > Code: One chunk of code in different languages
  • Lesson > Image: An image

content-model-lesson

To model a lesson, we chose a modular approach where the content type called Lesson uses a reference field that contains references to other content types.

This approach is beneficial because content creators can arrange chunks of information in any order they want. Meanwhile, developers can control the how each chunk of information is presented.

The content model of this application

The following diagram displays the entire content model of this application, including:

  • The Layout content type references the Highlighted course content type
  • The Highlighted course content type references the Course content type
  • The Course content type references the Lesson content type

Knowing this, you can look into the hierarchy of this example app. Then, check out the corresponding hierarchy of the content types in the Contentful web app. Exploring the setup of this application will help strengthen your understanding of the relationships between the content model. Additionally, it shows how this is represented within this example app and the Contentful web app.

Diagram: Content model of "The example app"
The full content type hierarchy from the home route down to a lesson with lesson modules.

Field validation

Creating validation rules at the field level ensures that information is handled consistently. An example of why this is important is that you could prevent malformed data from crashing an application in production.

Some other common validation rules for fields include character limits and enforcing specific values, such as Beginner, Intermediate, or Advanced. The following resources have a complete list of fields and available field validations:

Screenshot: web app validations

The proceeding screenshot shows example validations within the Contentful web app.

Go to the next lesson