Let two fields repeat

Is there a way to show 2 fields and repeat them in the panel?

I want to enter multiple textareas on a page.
Every textarea should have a heading. So two fields: heading and a textarea that repeat.

How can I accomplish this in Kirby?

  • I tried blocks, but the two fields must be mandatory. Always 1 heading and 1 textarea.
  • I tried structure, but the view in the panel is like a table. And not editable form fields on the spot.

You could create a custom block with two fields, heading and textarea and make these editable, either by creating a custom preview or using this plugin:

Exactly what I needed!!
I’m very relieved it can be done in Kirby, thank you very much!

I took me some time to get it to work, because I’m a total beginner in Kirby. The example code was a bit too brief for me.
My resulting code I added here.

Thx, René

myPage.yml

title: my Page

fields:
  Alinea:    #name of the block
    type: blocks
    fieldsets:
      alinea:
        name: myAlinea
        preview: fields  #this is the important command
        wysiwyg: true
        label: false  
        fields:  #fields that are repeated in this block
          head:
            type: text
          text:
            type: textarea