Can't figure out how to link CMS to my page variable

Hi, I’m very new to this.

[SOLVED]

I don’t currently have the vocabulary to search for this properly, I’m sure it must be a simple thing to figure out, but I’m stuck.

My post page variables hold a cover image:

     cover:
        image: "<image path/url>"
        alt: "<alt text>"
        caption: "<text>"

My config.yml fields for the collection type in the CMS looks like:

fields:
      - {label: "Author", name: "author", widget: "hidden", default: "Me"}
      - {label: "Title", name: "title", widget: "string", required: true}
      - {label: "Date", name: "date", widget: "date", required: true}
      - {label: "Description", name: "description", widget: "string", required: true}
      - {label: "Tags", name: "tags", widget: "list", required: false}
      - {label: "Body", name: "body", widget: "markdown"}

I need to add config.yml field(s) for my cover image, alt and caption - but I can’t get the syntax right - the three required fields are “nested” under cover:

What is the correct way to handle this, please?

Thanks in advance for your help.

Ah, should’ve kept at it a bit longer. I’ll leave this here in case it helps anyone. Especially if they’re experimenting with the papermod theme.

Object widget from docs solved the issue.

Code in config became:


    fields:
      - {label: "Author", name: "author", widget: "hidden", default: "Olly Bee"}
      - {label: "Title", name: "title", widget: "string", required: true}
      - {label: "Date", name: "date", widget: "date", required: true}
      - {label: "Description", name: "description", widget: "string", required: true}
      - {label: "Tags", name: "tags", widget: "list", required: false}
      - {label: "Body", name: "body", widget: "markdown"}
      - label: "Cover"
        name: "cover"
        widget: "object"
        fields:
          - {label: "Image", name: "image", widget: "image", required: false}
          - {label: "Alt", name: "alt", widger: "string", required: false}
          - {label: "Caption", name: "caption", widger: "string", required: false}