Skip to content

Kirby 5.0.0

content

Set how Kirby handles content

Content file extension

Set the extension you want to use for your content files.

Possible values: txt| md (default: txt)

return [
  'content' => [
    'extension' => 'md'
  ]
];

Ignore files/folders

Set an array of file/folder names that are not scanned by Kirby's core.

return [
  'content' => [
    'ignore' => []
  ]
];

Content locking

Deactivate the content locking mechanism used by the Panel to prevent concurrent edits to a page, file or user:

return [
  'content' => [
    'locking' => false
  ]
];

Salt for drafts and media files

URLs of page drafts and media files contain a hashed token that should be hard to guess. The token is based on the filesystem path of the page/file by default, but you can define your own salt that will be used instead:

return [
  'content' => [
    'salt' => '...'
  ]
];

You can also dynamically generate a salt based on the model that needs a token:

return [
  'content' => [
    'salt' => function ($model) {
      return '...';
    }
  ]
];
New in 5.0.0

When generating a salt for preview authentication tokens of drafts and versions, the closure will not receive as model as argument as those tokens are only based on the URI. The salt callback instead receives null and is expected to return a fixed model-independent salt in this case. When generating a salt for a file media token, the file object is still passed as model.

UUID generation

Kirby generates a unique alpha-numerical ID for each new page and file by default.

If you prefer the standard UUID v4 format, you can configure Kirby to generate those instead:

return [
  'content' => [
    'uuid' => 'uuid-v4'
  ]
];

Please note that this setting only takes effect for newly generated UUIDs. Existing UUIDs stay unchanged to preserve references throughout your site.

If you don't need UUIDs in your projects, you can disable them entirely:

return [
  'content' => [
    'uuid' => false
  ]
];

Access to file originals by URL

Uploaded files can be accessed with URLs of the form https://example.com/some/page/file.pdf or https://example.com/some-site-file.pdf. This can be useful to share clean links to files that keep working even if the media URL changes, e.g. when moving the site to a different server.

Depending on the nature of your files, you can control this behavior either globally or dynamically per file by setting the content.fileRedirects option.

Possible values: true| false | Closure (default: false)

return [
  'content' => [
    'fileRedirects' => false
  ]
];

You can also dynamically control this behavior, e.g. based on a file field or other custom logic:

return [
  'content' => [
    'fileRedirects' => fn (File $file): bool => $file->public()->toBool()
  ]
];