Content panel

The Content panel is the CMS of your site.

You define collections, and you fill them with items.

Example: a collection "Blog posts" with the items "First post" and "Second post".

Collections and items

  • A collection defines the fields of one content type.
  • An item is one entry that follows the collection.
  • The Designer shows the items in dynamic lists, sliders, and detail pages.

Create a collection

  1. Open the Content panel.
  2. Click New collection.
  3. Type a name. Example: "Blog posts".
  4. Add fields. Click Add field for each one.
  5. Select a type for each field.
  6. Click Save.

Field types

A collection can use 19 field types.

TypeWhat it holds
TitleThe name of the item. Every collection has a Title field, and it is always required.
SlugThe last part of the item's address. Example: first-post in /blog/first-post. Every collection has a Slug field. It follows the title until you type your own slug.
TextPlain text. One line, or a paragraph when you set the input to Multiline. Text holds no formatting.
Rich textA paragraph of plain text, in a text area. It is the older name for a multiline Text field.
ContentThe long body of the item. You write it in the block editor, with headings, lists, images, tables, quotes and embeds. Splitleaf saves it as a Markdown file.
NumberA number.
DateA day.
Date and timeA day and a time. Splitleaf stores it in UTC and shows it in your local time.
BooleanOn or off, with a toggle.
SelectOne choice from a list of options that you set.
Multi-selectSeveral choices from a list of options that you set.
URLA link.
ImageOne image, with its alt text.
ImagesA gallery. Several images in your order, each with its alt text.
ColorA color, or a color variable of your site.
ReferenceA link to one item in a different collection.
Multi-referenceLinks to several items in a different collection, in your order.
ListText rows that repeat. You add as many rows as you need.
GroupFields that belong together, shown as one card. A group can hold every type except Title, Slug and Group.

Field settings

Each field has a name and a type. These settings are optional.

SettingWhat it doesFields
LabelThe name editors see above the field.All
DescriptionA short help text under the label. The agent reads it too, so write what the field is for.All
RequiredAn item with an empty required field is Incomplete. It stays on your computer and does not publish.All
OptionsThe choices to pick from.Select, Multi-select
Minimum and maximumThe lowest and the highest number allowed.Number
Whole numbersAllows no decimals.Number
Negative numbersAllows numbers below zero.Number
Minimum and maximum lengthThe fewest and the most characters allowed.Text
InputSingle line or Multiline.Text
Target collectionThe collection the field links to.Reference, Multi-reference
Display ruleShows the field only when a different field has a given value.All

Conditional visibility

A field can have a display rule.

The field then shows only when a different field has a given value.

Example: the field "Video address" shows only when "Has video" is on.

  1. Open the field settings.
  2. Add the display rule: select the other field, the condition, and the value.
  3. Save the collection.

Connect collections with references

Example: each blog post has one author.

  1. Make a collection "Authors".
  2. In "Blog posts", add a field with the type Reference.
  3. Select "Authors" as the target collection.
  4. In each blog post, select the author.

In the Designer, you can then show the author name on the blog card.

Create and publish an item

  1. Open a collection.
  2. Click New item.
  3. Fill the fields.
  4. Save the item.

A new item is a draft.

Set a draft to go live, then publish the site to make it live.

The item list shows the state of each item.

The files and their schemas

Your content is plain files in your site folder. You can open them in any code editor.

FileWhat it holds
content/<collection>/_collection.jsonThe collection: its name, icon and fields. The folder name is the collection's ID.
content/<collection>/<item>/_item.jsonOne item: its field values and its state. The folder name is the item's slug.
content/<collection>/<item>/<field>.mdThe text of a Content field, as Markdown.
splitleaf.config.jsonThe site: its pages, settings and connections. It sits at the root of the site folder.

The first line of each JSON file names its schema. A schema is a public description of what the file can hold. Code editors such as VS Code read the schema and check your changes as you type.

SchemaChecks
collection.v1.json_collection.json
item.v2.json_item.json
config.v3.jsonsplitleaf.config.json

Example: a collection "Blog posts" with a title, a slug and a body.

{
  "$schema": "https://splitleaf.eu/schema/collection.v1.json",
  "name": "Blog posts",
  "icon": "note-pencil",
  "fields": [
    { "name": "title", "label": "Title", "type": "title", "required": true },
    { "name": "slug", "label": "URL Slug", "type": "slug", "required": true },
    { "name": "content", "label": "Content", "type": "content" }
  ]
}

Good to know:

  • The item schema checks the keys Splitleaf writes on every item, such as _draft and updatedAt. It does not check your field values, because each collection has its own fields. Splitleaf checks the values each time you save an item.
  • Splitleaf keeps keys it does not know. Your own notes in a file stay there.
  • A file saved by a newer Splitleaf opens read-only. Update the app to edit it.