Structured Content

How Netlify Create works with structured content, along with content modeling basics.

Netlify Create sites rely on structured content that can drive both the presentation and behavior of your site, an approach we call content-driven development. This guide explores how Netlify Create works with structured content in content-driven sites.

Content Requirements

Netlify Create's only real requirement that affects your site's code is that content must be structured and separated from code.

For a page to be editable in Netlify Create, its content must be represented by a structured data object coming from a content source. This type of object is referred to as a document. For components to be editable, they must also be represented by structured content, either as their own document or embedded inside another document (more on this below).

Documents of a similar structured are grouped together in the content source using a model. In other words, we can say that every editable page and component is represented by a model in your content source.

Types of Models

Netlify Create uses three types of models:

  • Page: That which represents the shape of a page, as mentioned above. Example: A blog site that uses a Post model for its individual blog posts.
  • Data: Content objects which are meant either to stand alone and be accessed globally, or to be referenced from a page. Global example: A Header model that contains content for a site's main menu. Reference example: A blog site uses an Author model to apply rich attributes to Post content (via a reference field).
  • Object: Repeatable content that is embedded in another model (of any type). Component models are typically object models. See the composable page section below for a detailed example.

Here's an example of how elements on a web page may be modeled:

Modeling Elements on a Web Page
Modeling Elements on a Web Page
  • The header and footer content comes from globally-shared content objects of a data model.
  • The content specific to the page is wrapped in a page object.
  • Content for components within that page are of the object type, and are embedded within the page object.

Content Modeling for Headless CMS

Netlify Create automatically inherits the schema (collection of models) from the API CMS.

However, because most API CMSs don't have the concept of pages, page models must be extended with Netlify Create-specific attributes by setting type within the models property,

See `models` property reference

Distinguishing Model Types

Whether Netlify Create can resolve the distinction between the data and object type for the remaining (non-page) models depends on the behavior of the CMS.

Contentful Example

Contentful has no concept of model types. Everything is an entry. Therefore, all non-page models from Contentful are assumed to be data models.

Sanity Example

Because Sanity has the concept of documents and objects, all documents that aren't pages become data in Netlify Create, which Sanity objects remain object in Netlify Create.

Content Modeling for Git CMS

When using Git CMS as the content source (files in the repository), you may not have any concept of modeling, as you can technically use files as a content source without any sort of schema.

Netlify Create requires that all content objects be defined by some model. Therefore, file-based content must be represented by model definitions in the Netlify Create configuration file.

See the content modeling reference