Filenames
When an editor creates an entry, SP CMS names the file from the collection's filename template. The default is:
filename: '{year}-{month}-{day}-{primary}.md'A post titled "Hello world" created on 1 March 2026 becomes 2026-03-01-hello-world.md. With format: json, yaml or toml, the default extension is .json, .yml or .toml instead. There's no separate extension key: the template sets it.
By default, the template starts in the folder where the editor chooses New entry. Start the template with / to start at the collection's path from any folder. Slashes between segments create subfolders. Field values are slugified, so a title such as News / Updates becomes the single segment news-updates. Changing the template only affects new entries.
Common templates
Folder per entry and date folders
To give each entry its own folder, set filename: '{primary}/index.md' and show the collection as a tree with view: { layout: tree, node: index.md }. Creating "About" in src/content/pages then writes src/content/pages/about/index.md. See collection views.
For a date archive, start the template at the collection's path so editors can create a post from any year or month folder:
path: src/content/posts
filename: '/{year}/{month}/{year}-{month}-{day}-{primary}.md'With this template, creating "Hello" on 27 November 2026 from src/content/posts/2026 writes src/content/posts/2026/11/2026-11-27-hello.md.
With one file per language, the language code is added as the localization path rule says, for example 2026-11-27-hello.fr.md.
Use a flat template for collections with subfolders: false. Each path segment the template produces must be non-empty. A second leading slash, backslashes, and . or .. segments are invalid.
Tokens
Let editors change the filename
Use the object form to show a filename input:
filename:
template: '{primary}.md'
field: createfalse(default): hidden.create: shown only when creating an entry.true: shown when creating and editing. Editing it renames the file.
A filename the editor types is a single filename in the selected folder, not a path. The same applies when renaming.