Ashit Vora
Ashit Vora

Reputation: 2922

Multiple Relation Item in Netlify CMS

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

Upvotes: 0

Views: 214

Answers (1)

qbeauperin
qbeauperin

Reputation: 589

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

Upvotes: 0

Related Questions