Working with Models

What are Models?

Models are a configured group of fields that describe the structure of content. If you want an in-depth explanation of content models, visit the models concept documentation.

Setting up a Model

To create a content model, navigate to the Schema tab. From here you can click the blue + next to Models to create a new model. You will enter a name and description. The API Id (what you use to query the model) will be auto-generated.

This is the outer shell that will contain the fields that shape your content. A news card, for example, would have the fields:

  • Single Line Text: Post title
  • Rich Text Editor: Post description
  • Asset Picker: Cover image
  • Single Line Text: URL/slug

How to use a Model

To use a model, you'll need to understand the 'unopinionated' style of GraphCMS. GraphCMS at its core is not page-based, but model-based.

You'll want to create models for repetitive content such as cards, listings, products, and more - rather than for a web page.

Use in code

To use a content model in your code to serve content, you'll need to understand GraphQL. Read more about GraphQL in the docs here.