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
- Open the Content panel.
- Click New collection.
- Type a name. Example: "Blog posts".
- Add fields. Click Add field for each one.
- Select a type for each field.
- Click Save.
Field types
A collection can use 19 field types.
| Type | What it holds |
|---|---|
| Title | The name of the item. Every collection has a Title field, and it is always required. |
| Slug | The 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. |
| Text | Plain text. One line, or a paragraph when you set the input to Multiline. Text holds no formatting. |
| Rich text | A paragraph of plain text, in a text area. It is the older name for a multiline Text field. |
| Content | The 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. |
| Number | A number. |
| Date | A day. |
| Date and time | A day and a time. Splitleaf stores it in UTC and shows it in your local time. |
| Boolean | On or off, with a toggle. |
| Select | One choice from a list of options that you set. |
| Multi-select | Several choices from a list of options that you set. |
| URL | A link. |
| Image | One image, with its alt text. |
| Images | A gallery. Several images in your order, each with its alt text. |
| Color | A color, or a color variable of your site. |
| Reference | A link to one item in a different collection. |
| Multi-reference | Links to several items in a different collection, in your order. |
| List | Text rows that repeat. You add as many rows as you need. |
| Group | Fields 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.
| Setting | What it does | Fields |
|---|---|---|
| Label | The name editors see above the field. | All |
| Description | A short help text under the label. The agent reads it too, so write what the field is for. | All |
| Required | An item with an empty required field is Incomplete. It stays on your computer and does not publish. | All |
| Options | The choices to pick from. | Select, Multi-select |
| Minimum and maximum | The lowest and the highest number allowed. | Number |
| Whole numbers | Allows no decimals. | Number |
| Negative numbers | Allows numbers below zero. | Number |
| Minimum and maximum length | The fewest and the most characters allowed. | Text |
| Input | Single line or Multiline. | Text |
| Target collection | The collection the field links to. | Reference, Multi-reference |
| Display rule | Shows 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.
- Open the field settings.
- Add the display rule: select the other field, the condition, and the value.
- Save the collection.
Connect collections with references
Example: each blog post has one author.
- Make a collection "Authors".
- In "Blog posts", add a field with the type Reference.
- Select "Authors" as the target collection.
- 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
- Open a collection.
- Click New item.
- Fill the fields.
- 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.
| File | What it holds |
|---|---|
content/<collection>/_collection.json | The collection: its name, icon and fields. The folder name is the collection's ID. |
content/<collection>/<item>/_item.json | One item: its field values and its state. The folder name is the item's slug. |
content/<collection>/<item>/<field>.md | The text of a Content field, as Markdown. |
splitleaf.config.json | The 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.
| Schema | Checks |
|---|---|
| collection.v1.json | _collection.json |
| item.v2.json | _item.json |
| config.v3.json | splitleaf.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
_draftandupdatedAt. 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.