Page Models describe the content contained within the markdown files that have front-matter.
Page Models share the common model properties.
To better understand what a page model does, let's look at the following example that models an "article" page in the articles folder. Note that the root folder of your content is defined within the stackbit.yaml using the pagesDir
field. In this case our content is located in pagesDir: content
.
content/aritcles/installing-node.md
---
title: How to install Node.js
image_thumbnail: images/screenshot.jpg
show_image: true
---
# Et perhorruit quoque revocataque vellem
## Angue poma dentibus
Aridus nostra abstractus viris
vitataque labores hiatus ultima, favistis Hippothousque vincemus cum, nymphae
[triformis aera quae](<http://aether-diurnos.io/tamen.aspx>) templa.
The corresponding page model defined in the stackbit.yaml will turn all markdown files in the articles folder into Article content types.
stackbit.yaml
...
pagesDir: content # the root folder of all markdown pages
models:
article:
type: page # page models should always have "page" type
label: Article
folder: articles # the folder where these markdown files are located
match:
- "**/*" # match all files and subfolders in the articles folder
exclude:
- "index.md" # exclude a file in the articles folder
fields: # field models
- type: string
name: title
label: Title
description: The title of the page.
required: true
- type: string
name: image_thumbnail
label: Image
description: the articles image
- type: boolean
name: show_image
label: Show Image
description: Show or hide the image
layout
page
pageLayoutKey
is defined