Content
Define editable collections and files in your repository.
What content does
content defines what editors can edit.
Each entry is either:
- a
collectionfor many files with the same schema, - a
filefor one file with its own schema.
Keys
| Key | Description |
|---|---|
name * |
Unique internal name (e.g. "posts"). |
label |
UI label (e.g. "Blog posts"). |
type * |
Values: collection, file. |
path * |
Folder for collections or file path for single files (e.g. "content/posts", "data/site.yml"). |
fields |
Field definitions shown in the editor. See Fields. |
filename |
Collection filename template or object config. See Filename. |
exclude |
Files to ignore in a collection (e.g. ["README.md"]). |
format |
File format. Values include yaml-frontmatter, json-frontmatter, toml-frontmatter, yaml, json, toml, datagrid, code, raw. |
delimiters |
Custom frontmatter delimiters (e.g. "+++", ["<!--", "-->"]). |
subfolders |
Enables or disables nested folders in collections. |
list |
For type: file, store the whole file as a top-level array. |
view |
Collection list settings for fields, sorting, search, and tree mode. See View. |
commit |
Per-entry commit settings. See settings. |
*: Required
Start with a collection
content:
- name: posts
label: Posts
type: collection
path: content/posts
fields:
- name: title
type: string
- name: body
type: rich-text
Start with a single file
content:
- name: site
label: Site settings
type: file
path: data/site.yml
fields:
- name: title
type: string
- name: description
type: text
Fields
fields defines the editor schema.
Field types
| Type | Description |
|---|---|
block |
Multiple object shapes in one list. |
boolean |
True/false toggle. |
code |
Code editor with syntax highlighting. |
date |
Date or date-time input. |
file |
File picker or uploader. |
image |
Image picker or uploader. |
number |
Numeric input. |
object |
Nested group of fields. |
reference |
Link to another collection. |
rich-text |
Rich text editor. |
select |
Fixed local options. |
string |
Single-line text input. |
text |
Multi-line plain text input. |
uuid |
UUID v4 field. |
body is a special key
For frontmatter formats, body maps to the file content below the frontmatter.
All other fields stay in frontmatter.
fields:
- name: title
type: string
- name: body
type: rich-text
File editor
If fields is omitted or empty, Pages CMS falls back to a raw file editor.
Use this for files that should not be modeled as structured fields, for example:
robots.txt,- redirect files,
- small JSON or YAML config files,
- snippets or templates.
Example:
content:
- name: robots
label: robots.txt
type: file
path: public/robots.txt
If you want code editing behavior, set a code-oriented format:
content:
- name: redirects
type: file
path: public/_redirects
format: code
Datagrid editor
Use format: datagrid for CSV-style tables.
For .csv files, Pages CMS can infer this automatically.
content:
- name: pricing
type: file
path: data/pricing.csv
Or set it explicitly:
content:
- name: pricing
type: file
path: data/pricing
format: datagrid
Filename
filename only applies to collections.
Use it to control how new files are named.
String form
filename: "{primary}.md"
Object form
Use the object form when you also want a filename field in the editor.
filename:
template: "{year}-{month}-{day}-{primary}.md"
field: create
filename.field
| Value | Behavior |
|---|---|
false |
Hide the filename input. |
create |
Show it only when creating a new entry. |
true |
Show it when creating and editing. |
Filename tokens
| Token | Description |
|---|---|
{primary} |
Primary field from view.primary, or title, or the first field. |
{slug} |
Alias for {primary}. |
{year} |
Current year. |
{month} |
Current month, zero-padded. |
{day} |
Current day, zero-padded. |
{hour} |
Current hour, zero-padded. |
{minute} |
Current minute, zero-padded. |
{second} |
Current second, zero-padded. |
{fields.<name>} |
Field value from the current entry, slugified. |
{<name>} |
Shorthand for {fields.<name>}. |
Example:
filename: "{year}-{month}-{day}-{title}.md"
View
view only applies to collections.
It controls how the collection list is displayed.
Keys
| Key | Description |
|---|---|
fields |
Fields shown in the list, in order (e.g. ["title", "published", "author.name"]). |
primary |
Field used as the main label. Defaults to title if present. |
sort |
Fields available for sorting. |
search |
Fields indexed for search. |
default.search |
Default search query. |
default.sort |
Default sort field. |
default.order |
Values: asc, desc. |
layout |
Values: list, tree. |
node |
Tree node config, as a string or object. |
node.filename |
Node filename in tree mode. |
node.hideDirs |
Values: all, nodes, others. |
Example:
view:
fields: [title, published, date]
primary: title
sort: [date, title]
default:
sort: date
order: desc
Root arrays in single files
If a file stores a top-level array, set list: true.
content:
- name: authors
label: Authors
type: file
path: data/authors.json
format: json
list: true
fields:
- name: name
type: string
- name: email
type: string
- name: avatar
type: image