So I have started my first Kirby site

and I got a few questions if you don’t mind.

In order to upload images to a page I need a file section. If I want multiple single uploads like, hero-image and a profile-image then I can this:

  profile:
    type: files
    max: 1
    layout: cards
    size: tiny
  hero:
    type: files
    max: 1
    layout: cards
    size: tiny

When I upload 1 image it adds the image to both of them unless I use the “template” property. Is that correct?

If I use the same template property for both uploads it uploads to both of them in 1 upload. Like above.

I gotta admit despite reading the docs many times and reading Kirby in a nutshell then I am confused about pages sections, pages fields, files sections, file fields etc.

Any help would be appreciate. Perhaps there are a theme out there which deals with multiple images. The starter kit does not seem do so.

Thanks

If not specified with the template value, all images were saved into the content-folder of the current page. You can either upload images directly in the field dialog or either, if you use the page preset, in the files section in the sidebar. For the latter you then just select the already uploaded files in your desired file-field -> profile or hero in your case.

Can you show your full blueprint please?

I guess you have 2 files sections, so because it can be only one, you see files as duplicates in both sections, and if you assign different templates, then you see filtered results, so it appears, that you have different files there.

For files/images there are 2 things in blueprint:

  • Files Section shows all files, that are uploaded to page. If you define template, then it will show only files with this template.

  • Files Field field lets you select files, that are already uploaded, or you can also use file field to upload files.

So if you want to show images in two different areas on the same page, like profile photo and hero photo, you need one “files section” with files, and two file fields. Or just two file fields.

For what you want to achieve, structure can be like this:

    sections:
      yourfieldstoshow:
        type: fields
        fields:
          profile:
            type: files
          hero:
            type: files
      yourfilessection:
        type: files
        template: image

structure

Also one more thing. If you will upload photos not from files section, but from fields (“profile” or “hero”), you should also add templates to see these files in files section (if it has filter “template: image”), this way template “image” will be assigned to them:

sections:
  yourfieldstoshow:
    type: fields
    fields:
      profile:
        type: files
        uploads:
          template: image
      hero:
        type: files
        uploads:
          template: image
  yourfilessection:
    type: files
    template: image

Hi @Roman

Many thanks for detailed explanation. It was very helpful. I was having dinner and while eating I was wondering if its meant to be that you upload all images you want on a page in 1 field (section in this case) and then you use the fields to split out those images e.g. into hero and profile. For me though that seems a little odd. At least from what I am used to.

I know I can upload directly to the field by clicking the Add button but drag and drop does not work. So I thought I was doing something wrong.

And this was also very helpful. That helped me understand the template part. Thanks!

Welcome, hope you will be enjoying Kirby soon :slight_smile:

I understand what you expect, in other CMS or builders most of times there would be just “fields”, where you drag and drop files, here it’s different. Normally there is no problem, as usually there is only one field, that would need multiple files upload at once. But still, if you want two drag and drop (easier/faster to upload) fields, you can have two files sections with different templates, and to print according images you could filter by templates.