Alternative folder setup

Now it’s possible to configure more folder paths than before.

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

My first test went perfect.

My current folder setup

Root

cache
kirby
panel
plugins
site
user

Nested

cache
  content
  thumbs
kirby
panel
plugins
site
  assets
  blueprints
  config
  controllers
  snippets
  templates
user
  accounts
  content

Cache

For me both these are cache data so I put them into a cache folder.

cache/content
cache/thumbs

Kirby + Panel

I don’t like to have them as two folders in the root. I would like them to be inside a core folder but that failed.

Plugins

I often work with plugin and for me it takes alot of clicks to get into the right plugin. Now it’s in the root. It also makes sense to have it as an own section because it’s often general stuff.

Assets

I moved assets from the root to site. I think it belongs better here.

site/assets

Be aware, if you want to do this as well you need to change the htaccess file in a less secure way:

# RewriteRule ^site/(.*) index.php [L]

The hash disables this line. It allows the assets to be in the site folder. If you have a better way to allow only assets in the site folder, be my guest. :slight_smile:

User

Everything that the user does in the panel is in the user folder.

user/accounts
user/content

Code

$kirby = kirby();

# User / Accounts
$kirby->roots->accounts = $kirby->roots()->index() . DS . 'user' . DS . 'accounts';

# User / Content
$kirby->roots->content = $kirby->roots()->index() . DS . 'user' . DS . 'content';
$kirby->urls->content = $kirby->urls()->index() . '/user/content';

# Cache / Content
$kirby->roots->cache = $kirby->roots()->index() . DS . 'cache' . DS . 'content';

# Cache / Thumbs
$kirby->roots->thumbs = $kirby->roots()->index() . DS . 'cache' . DS . 'thumbs';
$kirby->urls->thumbs  = $kirby->urls()->index() . '/cache/thumbs';

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

# Assets
$kirby->roots->assets  = $kirby->roots()->index() . DS . 'site' . DS . 'assets';
$kirby->urls->assets  = $kirby->urls()->index() . '/site/assets';

If you have any feedback or can help with my unsolved issues, write…

Thanks! :slight_smile:

3 Likes

I actually put content, accounts and avatars together into one project-content folder, but prefer to have the assets in their own folder.

I’ve never used avatars. But I had in mind to place avatars in users, together with content and accounts. :slight_smile: