Content Sources
Technical reference for working with one or more content sources.
Content sources are configured through the contentSources
property.
Defining Content Sources
All content sources are now configured using the contentSources
properties.
When possible, Stackbit infers the content schema from the source through each source's module. That schema can then be extended using the modelExtensions
property.
The exception to this is Git CMS, which requires that you define the content schema when configuring the source.
contentSources
Define one or more content sources that your project is using.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
- Each content source has its own module with a unique set of properties. See the following integration guides for more information about working with that source:
- Contentful
- Git CMS
- DatoCMS
- Sanity
- Custom (for sources not listed)
- For most sources, this property must be paired with the
modelExtensions
property to tell Stackbit which models represent your pages.- See Content Modeling for the technical reference.
Deprecated Properties
contentSources
property.
assets
(deprecated)
Tells Stackbit where to store and retrieve media files for projects using files as the content source.
cmsName
(deprecated)
Tells Stackbit to use files as the content source.
1
2
3
4
- This is deprecated for all values other than
git
. Projects using API CMS(s) should use thecontentSources
property.
dataDir
(deprecated)
The directory containing non-page data. These are typically values that are used globally across your project, like site title and URL, or SEO defaults.
1
2
3
4
5
excludePages
(deprecated)
Excludes files in your pagesDir
that should not be treated as pages.
1
2
3
4
5
6
models
(deprecated)
The models property defines the structure of your content when using files as your content source. For API CMSs, this property provides useful overrides and decorations to your remote schema.
modelsSource
(deprecated)
Tells Stackbit where to look for YAML files that define individual models. This is typically not needed, but can be used to load models from external packages or third-party libraries.
1
2
3
4
5
6
7
8
- This is deprecated for API CMSs, which should use the
contentSources
property. - If
cmsName
is set togit
, Stackbit automatically looks in.stackbit/models
for YAML model definitions. - Directories should be listed from lower to higher priority. If Stackbit finds conflicting models, it will use the one defined last in the array of directories.
- Model files must have a
.yaml
or.yml
file extension and the directory must exist, or the Stackbit visual editor may not work properly.
objectTypeKey
(deprecated)
Defines the field name used to identify the type of objects referenced by model
or reference
fields.
1
2
3
4
5
pageLayoutKey
(deprecated)
Defines the field name used to match pages to the appropriate page model.
1
2
3
4
5
pagesDir
(deprecated)
The directory containing page content.
1
2
3
4
5