What are the assets and media folder used for?

Pretty silly question, but I found no info in the docs. My question arises from the asset() helper. If I need to pull out an asset, I need to do:


…which is a bit confusing at first. Shouldn’t asset() use the assets root? It certainly makes sense to call:


…and get the asset? Then, I looked at the asset() docs and the Asset object and saw that it’s used to provide helper functionality. I thought that maybe the asset() function generates files in the media folder for some caching functionality. I tested it by passing my stylesheet there, but nothing happened.

To be more clear with the question, I guess, what will happen if I change the assets root? What is it meant to contain?

In general, I think that it’d be very helpful if Kirby had a description of each folder in one place so you can quickly grasp the whole structure of a Kirby project, and by extent - of Kirby in general. For example:

  • content is for the TXT files containing the content of your pages, as well as the files accompanying them
  • site contains basically all site configuration
    • blueprints determine the schema of your page data, as well as metadata for files and users
    • templates contains PHP files that output the corresponding HTML for each page type

I think something like that will be very useful to serve as the glue for the whole Guide and a good starting point in general.

The asset folder is not required, it is not even part of the Plainkit. The asset helper is only there to convert files from locations outside the content folder into, well, asset objects. What you call these folders where you store your assets is totally up to you. I even thought the assets root was deprecated, but there I was mistaken, it seems.

1 Like

Then what’s the purpose of the assets root? I was living with the impression that files in assets are handled in a special way. I made two idea issues:

See this: https://github.com/getkirby/kirby/issues/2229#issuecomment-544692588

1 Like