Skip to content

Netlify CMS shows empty category when category is a string #235

@timwis

Description

@timwis

JKAN supports two types of values for a dataset's category: a string (for a single category), or an array of strings (for multiple categories).

name: City Budget
category: Finance
name: Bicycle Lanes
category:
  - Transportation
  - Planning / Zoning

Netlify CMS is configured to allow multiple values for this field. Unfortunately, it seems that if you edit a dataset with a string value (as in the first example above), the UI shows the field as blank.

Fortunately, if you save, it keeps the existing category value (unless you change the category), so it won't lose the value, but it can be confusing for users.

It would be great if we could submit a PR to Netlify CMS to fix this. But in the meantime, it might be worth adding a linter of some sort to JKAN to enforce a schema. We could also add it to a jekyll upgrade-jkan CLI (to fix any string values).

EDIT: I previously thought this would silently drop existing category values, but I've confirmed that it doesn't.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions