Multiple Relation Item in Netlify CMS

223 Views Asked by At

I've two collections

  1. Posts
  2. Categories

In my case, each post can have multiple categories.

Hence the way I'm setting it is Post has a field of type List which is further a Field of type Relation. Is there a straightforward way to specify this relationship?

Thanks

1

There are 1 best solutions below

0
On

The Relation widget has a multiple option that, when set to true, will do just that without having to rely on a list widget.

eg:

fields:
  - label: 'Categories'
    name: 'categories'
    widget: 'relation'
    collection: 'categories'
    value_field: '{{slug}}'
    display_fields: [title]
    search_fields: [title]
    multiple: true