Warning
You're browsing the documentation for an old version of Webiny. Consider upgrading your project to Webiny 5.39.x.
WHAT YOU'LL LEARN
  • how to create a content model
  • how to define content model’s fields

In this tutorial, we will learn how to create a content model. As an example, we will create a Product content model with the following fields:

FieldField Type
NameText
DescriptionLong text
PriceNumber

Content model creation is a two-step process: in step 1, we will create the model, and in step 2, we will define model fields.

Step 1: Create Content Model
anchor

  1. From the Side Menu, Click Headless CMS > Models.

  2. Click + NEW MODEL.

    ✔️ The New Content Model screen opens.

  3. In the Name textbox, type Product.

  4. In the Content model group drop-down, if you have already created a group, select that group; else select Ungrouped.

  5. In the Description textbox, type Demo Product Content Model.

  6. Click + CREATE MODEL.

    ✔️ Screen to configure the content model’s fields opens.

Step 2: Define Fields
anchor

  1. Drag and drop the TEXT field in the EDIT tab.

    ✔️ Field Settings - Text screen opens.

  2. In the Label textbox, type Name and click SAVE FIELD.

  3. Drag and drop the LONG TEXT field in the EDIT tab.

    ✔️ Field Settings - Long Text screen opens.

  4. In the Label textbox, type Description and click SAVE FIELD.

  5. Drag and drop the Number field in the EDIT tab.

    ✔️ Field Settings - Number screen opens.

  6. In the Label textbox, type Price and click SAVE FIELD.

  7. Click SAVE.

  8. Congratulations! You have created your first content model.

Additional Information
anchor

Field Validation
anchor

You can add various validations to a field from the VALIDATORS tab on the Field Settings screen. Depending on the field type, you can add different types of validations to your field.

Field ValidatorsField Validators
(click to enlarge)