Models map your theme's content to a structured schema. Models are defined in the stackbit.yaml under the models key. The three primary types of models that you will work with are:

Example

Assume a site with the following content structure:

.
├── content
│   └── posts
│       ├── post1.md
│       └── post2.md
├── data
│   └── config.yaml
└── stackbit.yaml

The stackbit.yaml would define 2 models. 1 page model representing the posts and 1 data model representing the config. Inside each of these models are the corresponding field models.

# stackbit.yaml

stackbitVersion: ~0.2.0
ssgName: custom
pagesDir: content
dataDir: data
...
models: # top level models key
  article: # a model called "article" 
    type: page # this is a page model
    label: Article
    folder: posts # matches all markdown files in the content folder
    fields: # array of field models, must be nested under a model
      - type: string
        name: title
        label: Title
  config: # a model called "config"
    type: data # this is a data model
    label: Config
    file: config.yaml # matches a single file
    singleInstance: true
    fields:
      - type: string
        name: title
        label: Sites Title
      - type: image
        name: logo
        label: Path to Logo Image

Models Naming Rules

As shown above, models are named as keys within the YAML file and must adhere to the following rules:

Model Types

Models must be one of the following types: