Filename customization

By default, TinaCMS does not enforce strict filename constraints, as operating systems support a wide variety of formats. However, you can enforce custom constraints at the collection level if needed.

Filename Rules

  • Filenames must contain only a-z, A-Z, 0-9 , -, _, ., or /.
  • Filenames cannot contain spaces
  • The filename generated must be unique within the collection
  • If the filename starts with /, it will be treated as an absolute path relative to the collection root
    • Example: /foo/bar/blog-post will be saved as <MyCollectionPath>/post/blog-post.md
  • If the filename does not start with /, it will be treated as relative to the current folder
    • Example: bar/blog-post will be saved as <MyCollectionPath>/<CurrentDirectory>/bar/blog-post.md

Configuration

ui.filename.readonly
boolean

Prevents the user from editing the filename


ui.filename.slugify
(values, meta) => string

A function that generates the filename based on form values


ui.filename.parse
(filename) => string

A function that sanitizes the filename input as the user types

Option A: Sanitizing Input with parse

The parse function allows you to enforce filename constraints within the editor. The provided callback function sanitizes user input in real-time.

Example using parse to enforce snake case

Option B: Generating Filenames with slugify

Use the slugify function to automatically generate filenames based on other fields in the collection.

The slugify function only applies constraints when the user creates new files. Users can still rename files freely after creation.

Example with slugify and read only

Example with default slugify

If no slugify function is provided and a field has isTitle: true, TinaCMS uses a default slugify function. This removes non-alphanumeric characters and replaces spaces with dashes.

Last Edited: February 4, 2026