decaporg / decaporg/decap-cms

Delete front matter values completely if optional string widget left empty in CMS

Open
#995 10 comments 8 reactions 0 assignees View on GitHub
area: extensions/widgets kind: enhancement pinned status: confirmed
Dominant language
JavaScript
Stars
19.4k
Forks
3.1k
Avg merge
1d 14h
Merged PRs (30d)
9

Description

**- Do you want to request a *feature* or report a *bug*?**
Request a feature

**- What is the current behavior?**
When emptying a field in the CMS, then re-publishing, it leaves the `example:` there

**- If the current behavior is a bug, please provide the steps to reproduce.**

**- What is the expected behavior?**
Delete it completely

**- Please mention your CMS, node.js, and operating system version.**

Netlify CMS 1.0, Node.js 6.12.3

**- Please link or paste your `config.yml` below if applicable.**
````yaml
backend:
name: git-gateway
branch: master # Branch to update (optional; defaults to master)

publish_mode: editorial_workflow
media_folder: "images"

collections:
- name: "scripts" # Used in routes, e.g., /admin/collections/blog
label: "Script Page" # Used in the UI
folder: "_posts" # The path to the folder where the documents are stored
create: true # Allow users to create new documents in this collection
slug: "{{year}}-{{month}}-{{day}}-{{slug}}" # Filename template, e.g., YYYY-MM-DD-title.md
fields: # The fields for each document, usually in front matter
- {label: "Layout", name: "layout", widget: "hidden", default: "script"}
- {label: "Script Name", name: "title", widget: "string"}
- {label: "GitHub Username", name: "gh_username", widget: "string"}
- {label: "Repository Name", name: "repo_name", widget: "string"}
- {label: "Screenshot", name: "screenshot", widget: "image", required: false}
- {label: "Documentation URL", name: "doc_url", widget: "string", required: false}
- label: "Category"
name: "categories"
widget: "select"
options:
- { label: "Blog", value: "Blog" }
- { label: "Documentation", value: "Documentation" }
- label: "Does this repository use Netlify CMS?"
name: "cms"
widget: "select"
options:
- { label: "No", value: "false" }
- { label: "Yes", value: "true" }
- {label: "Description", name: "body", widget: "markdown"}
````

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.