Register new custom roots

https://getkirby.com/docs/developer-guide/configuration/folders

In site.php in the root of the installation it’s possible to change the roots like this:

$kirby = kirby();
$kirby->roots->snippets  = $kirby->roots()->index() . DS . 'snippets';
$kirby->roots->plugins  = $kirby->roots()->index() . DS . 'plugins';

Register own roots

It’s also possible to add own custom roots, like this…

site.php in root of your installation:

$kirby->roots->bricks = $kirby->roots()->index() . DS . 'bricks';

Get it in a snippet/template/pattern like this:

echo kirby()->roots()->bricks();

It can be a perfect way to customize the urls for a plugin.

(I did not get the same thing to work with urls)

I also wrote about it here: https://github.com/jenstornell/kirby-secrets/wiki/Custom-folder-setup

1 Like