content is a list. Each item is one of three types:

  • collection: a folder of files that share fields, such as blog posts.
  • file: one file with its own fields, such as site settings.
  • group: a sidebar section containing other items.

Collections

Add a collection to .pages.yml to edit the files in a folder:

content:
  - name: posts
    label: Posts
    type: collection
    path: src/content/posts
    fields:
      - name: title
        type: string
      - name: body
        type: rich-text

Every file in path with the collection's extension is an entry. The extension comes from the filename template, .md by default. New entries are created in the folder and named by that template.

If a folder with many entries times out while loading, set large: true on the collection. SP CMS then reads the folder at one commit and loads its files in batches. The first load can take longer; later refreshes reuse cached text for unchanged files. Sorting, search and pagination still work across the whole collection.

Files

Add a file to .pages.yml to edit it on its own:

content:
  - name: settings
    label: Site settings
    type: file
    path: src/data/settings.yml
    fields:
      - name: title
        type: string
      - name: description
        type: text

path is the full path to the file, including its name. If the file is a top-level list, such as an array of authors, set list: true. An object such as list: { min: 1, max: 20 } also limits the number of items.

- name: authors
  type: file
  path: src/data/authors.json
  list: true
  fields:
    - name: name
      type: string
    - name: avatar
      type: image

Without fields, a file opens in a source editor. See file formats.

Groups

Groups organise the sidebar. They don't change where content is stored, and they can be nested. A group takes name, label, type: group and items, but no icon.

content:
  - name: blog
    label: Blog
    type: group
    items:
      - name: posts
        type: collection
        path: src/content/posts
        fields: [{ name: title, type: string }]
      - name: authors
        type: collection
        path: src/content/authors
        fields: [{ name: name, type: string }]

Keys

Key Applies to Description
name All Required. Unique ID: letters, numbers, - and _. Must be unique across all collections and files, including those in groups.
type All Required. collection, file or group.
label All Name shown in the sidebar. Defaults to name.
icon Collection, file A Hugeicons name for the sidebar, such as News01.
path Collection, file Required. Folder (collection) or file path (file), relative to the repository root, without a leading or trailing /.
fields Collection, file The fields to edit.
format Collection, file How files are read and written. Inferred from the extension; see file formats.
delimiters Collection, file Custom front matter delimiters, such as +++ or ["<!--", "-->"].
filename Collection Template for new filenames. See filenames.
view Collection Columns, sorting, search and tree layout. See collection views.
subfolders Collection Set false to ignore files in subfolders.
exclude Collection Filenames to ignore, such as [README.md].
large Collection Set true to load a large folder in batches. Defaults to false.
create.label Collection Text for the New entry button, for example create: { label: Add a newsletter }.
list File true when the file is a top-level list, or { min, max } to also limit its length.
operations Collection, file Turn off create, rename or delete. See below.
i18n Collection, file How translations are stored. See localization.
commit Collection, file Commit messages, identity and custom messages for this content. See settings.
actions Collection, file Action buttons. See actions.
items Group Required. The collections, files and groups inside it.

Operations

By default editors can create, rename and delete collection entries, and create or delete a single file. Set an operation to false to turn it off:

- name: legal
  type: collection
  path: src/content/legal
  operations:
    create: false
    delete: false

Set operations: false to turn off every operation. Editors can still edit existing content.

Operation Collection default File default
create true true: create the file if it's missing
rename true Not available
delete true true

Operations apply to everyone, managers included, and SP CMS enforces them when saving as well as in the interface. They only take actions away; they don't grant access.

icon takes a name from the Hugeicons free set in PascalCase, with or without the Icon suffix, such as News01 or News01Icon. Unknown names fall back to the default icon. Media libraries also accept an icon.