decaporg / decaporg/decap-cms

Boolean widget with false value not rendered in MD

Open
#4,726 1 comment 0 reactions 0 assignees View on GitHub
type: bug
Dominant language
JavaScript
Stars
19.4k
Forks
3.1k
Avg merge
1d 14h
Merged PRs (30d)
9

Description

**Describe the bug**
When setting a Boolean widget to false, this key wont be rendered to the resulting Frontmatter/Markdown file with key: false but will be left out completely. This makes problems with Gatsby GraphQL queries where this field is part of the query.

**To Reproduce**
define boolean field like so:
`- {label: "Featured Post", name: "featuredpost", widget: "boolean", required: false}`

resulting MD file doesnt have the frontmatter key "featuredpost" included.

**Expected behavior**
a file like this gets generated:

```
---
templateKey: single-blog-post
title: My super blog post
featuredpost: false
---
Super Blog content
```

**Applicable Versions:**

- netlify-cms-app 2.14.5
- netlify-cms-core 2.36.4
- Github

**CMS configuration**
not disclosed

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.