Netlify-cms: List widget requires "fields" for one-field, contrary to the offical docs

Created on 4 Sep 2018  路  8Comments  路  Source: netlify/netlify-cms

Hello;

Contrary to the official docs, i've realized that single-item list widgets always need the key to be "fields" - not "field" - in order to work

Describe the bug
The example for a single-field list widget on the official docs won't work:

````

  • label: "Gallery"
    name: "galleryImages"
    widget: "list"
    field:

    • {label: Image, name: image, widget: image}

      ````

It seems that now it needs to be "fields" instead.

Expected behavior
Either recover the "field" value or correct the misleading documentation.

Screenshots
captura de pantalla 2018-09-04 a las 14 55 18

Applicable Versions:

  • Netlify CMS version: 2.0.11
  • Git provider: GitHub

CMS configuration
(only the two fields shown on screenshot)
- label: "Gallery"
name: "galleryImages"
widget: "list"
fields:
- {label: Image, name: image, widget: image}
- label: "Gallery2"
name: "galleryImages2"
widget: "list"
field:
- {label: Image, name: image, widget: image}

Most helpful comment

@erquhart If that's the case the docs need to be fixed because the example shows it as a list.

All 8 comments

Hmm, weird, that bug should have been fixed in 2.0.10 via https://github.com/netlify/netlify-cms/pull/1395?

@idiazroncero I'm not able to reproduce. Are you certain you're on 2.0.11? You can check the console when the CMS loads to be sure. If so, can you share a repo that reproduces this?

It's the same repo as in 1709 _(edited to prevent misleading references, they're not linked except from the fact that I reported both of them...)_
The repo is https://github.com/idiazroncero/dc-fotografia. It's based on https://github.com/danurbanowicz/eleventy-netlify-boilerplate wich pulls the NetlifyCMS from Unpkg.com using:

````

````

And the console.log prints 2.0.11 as the version.
The error happens both on Chrome and Firefox.

You can check the config.yml here:
https://github.com/idiazroncero/dc-fotografia/blob/master/admin/config.yml
Lines 17-34 are the ones to check.

The List widget fields are copied from the docs, that's why they wont' use single quotes for the field definitions as the rest of the file. Nevertheless, I tried everything, even both with and without quotes, to no avail.

Ah! It's because you're defining field with a list. Needs to be a map:

# wrong
field:
  - {label: Image, name: image, widget: image}

# right
field:
  {label: Image, name: image, widget: image}

@erquhart If that's the case the docs need to be fixed because the example shows it as a list.

Yep, I copy-pasted from the docs.

Awesome, thx

Was this page helpful?
0 / 5 - 0 ratings