Docs LATEST

Content Configuration

File-native page storage, page index settings, and parser options.

Configuration

config/content.php controls the file-native page layer and the content parser.

What changed in 2.x #

Core 2.x no longer ships multiple page storage drivers. Page content is file-native in Core, backed by a lightweight index for fast listing and filtering.

  • Pages live under content.drivers.file.path.
  • Listing and filtering run against the page index.
  • Parser behavior is controlled through content.parser.*.

File Driver #

These keys control where page files live and how their index is stored.

Key Description
content.drivers.file.path Content root, default content_path('pages')
content.drivers.file.index.driver Index backend: json or sqlite
content.drivers.file.index.json.path JSON index location
content.drivers.file.index.sqlite.path SQLite index location
content.drivers.file.cache_enabled Enable cached page and list lookups
content.drivers.file.cache_ttl Cache lifetime in seconds

Example #

return [
    'drivers' => [
        'file' => [
            'path' => content_path('pages'),
            'index' => [
                'driver' => env('CONTENT_PAGE_INDEX_DRIVER', 'json'),
                'json' => [
                    'path' => storage_path('index/page-index.json'),
                ],
                'sqlite' => [
                    'path' => storage_path('index/page-index.sqlite'),
                ],
            ],
            'cache_enabled' => true,
            'cache_ttl' => 600,
        ],
    ],
];

Choosing an index backend #

Backend When it fits
json Small and medium sites, simple deployments, easy inspection
sqlite Larger page sets, heavier filtering, or cases where you want indexed storage

If you change backends or suspect stale metadata, rebuild the index:

./velvet index:rebuild

Parser selection #

Driver Requirement Description
commonmark league/commonmark Full CommonMark spec with extensions
parsedown erusev/parsedown Fast Parsedown parser
html None Pass-through, no Markdown parsing

Set the parser with content.parser.driver or CONTENT_PARSER_DRIVER.


CommonMark extensions #

'commonmark' => [
    'html_input' => 'allow',  // allow, strip, escape
    'extensions' => [
        'table' => true,
        'strikethrough' => true,
        'autolink' => true,
        'task_lists' => true,
    ],
],

Parser caching #

content.parser.cache_ttl controls markdown cache lifetime in seconds. Set it to 0 to disable parser output caching.


Overrides #

Like the rest of the config system, content config can be overridden in user/config/content.php. In a tenant-aware install, tenant config overrides are applied after user config.