Custom file location

I am trying to find any conventions on where to store generated files (e.g. ‘json’, ‘schemas’, ‘database files’, the ‘favicon’ files, the ‘robot.txt’ file etc.)
I found the assets and the media folder, but I couldn’t find a clear explanation for when to use it and (more importantly) if placing files in those folders will mess-up any caching/image-conversion mechanisms?

The media folder is basically a cache folder, so nothing that belongs to the project (and especially not stuff under version control) should be stored there.

Alright, that makes sence.

So any manually controlled file should go into the assets folder.

So what about any dynamically generated files (some ‘schema’ file generated from a specific page-template for example)? It not really part of the project, but semi-content, semi-source related (i.e. could be made publicaly accesible for better machine-interpretation) Still better to put that into the ‘assets’ folder? As I remember from some comment in the documentation (cannot find it anymore :confused:) that files in the ‘media’ folder are directly accesible by url?

Yes, but so are files in the assets folder (because that folder usually contains stylesheets, js scripts etc.).

oke, so is there an inverse option available than? I.e. A place where dynamically generated files can be placed which should not be directly accessible by url? I know I can play around with ‘routes’, but I am not sure if those will catch all url-requests, and if there is a way to restrict direct access without comprimising the core-functionalities of Kirby

Yes, you can put them into a separate folder in the root folder, for example, and block access to this folder via .htaccess or your server config.

1 Like

You could cache your generated files in the site/cache folder and use a route if you want to serve them publicly.

1 Like

alright, that gives some idea’s. I’ll figure something out.

Thanks for the input!