Types

Data Source

The content/ folder in a project is where all your data lives (in JSON format). This is typically divided into multiple subfolders that define your types. Types are just a way to group content of a similar structure. Individual files inside a type are very flexible, in fact you can define any field schema you'd like and there are no required keys. Even though files may be grouped together as a type, they can actually have variability between them in terms of their field structure - just make sure you account for this in your corresponding layouts/content/ files! 

Accessing content in layouts

Any user defined fields in your json files are accessed by the content.fields prop in your layouts. The top level content prop has the following defined keys that are available for all content sources: 

  • content.pager
  • content.type
  • content.path
  • content.filepath
  • content.filename
  • content.fields

Single file types

Anything that appears at the first level within the content folder is a type. This can include single files such as index.json and 404.json, which are also types, but only have a one-off data source. You can define your own single file types this way if you'd like. You can also generate a single type using the CLI: plenti new type YOUR_TYPE --single=true

Blueprints

There is an optional, specially named file that goes inside your individual type folders named _blueprint.json. This defines the default content for that specific type (see issue 15). The Plenti Git-CMS uses this to create new content of a particular type. If you have a type that you don't want editors to be able to add new instances of, simply omit the _blueprint.json file. Note that --single content is not meant to be repeated and does not have a corresponding blueprint file.