Gallery with captions under each image

Hi,
I would like to be able to create a gallery in the panel and assign captions for each of the images. By now, I added “caption” to my blueprint but in my panel there is only one text field and it creates a same caption for each image.

name: Gallerie mit 3 33%igen Bildern
icon: dashboard
preview: gallery
fields:
  images:
    label: Bilder hinzufügen (mindestens 1, maximal 3)
    type: files
    multiple: true
    min: 1
    max: 3
    layout: cards
    size: tiny
    empty: field.blocks.gallery.images.empty
    uploads:
      template: blocks/gallery-3
    image:
      ratio: 1/1
  caption:
    label: Bildunterschrift
    type: writer
    icon: text
    inline: true

Thanks in advance!

If you use a files field with multiple images, you can only add a single caption. You have two options:

  • use a structure field with a files field and a caption field (and limit the number of files per field to one
  • Add the caption in the file metadata instead of the gallery block

Thanks, the metadata option sounds easier for me but I don’t really know what you mean by placing it in the file metadata. Could you please specify that? :slight_smile: The fields should be editable in the panel.

You can define blue prints for files, to capture any information you need, using any of the fields you would normally use for a page. This gets stored in a text file alongside each file. You can read more on this here: