decaporg / decaporg/decap-cms

widget: "string" - when entering single line text and saving, text in yml frontmatter splitting over 2 lines in error!

Open
#6,444 0 comments 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

My CMS is functioning as expected with the exception of the following issue:

When entering text in the title widget as a single line and saving, the preview pane display a single line, however when deployed the line is being split over 2 lines, in the frontmatter, in error as shown:

1 ---
2 title: AFTER HOURS... No Problem\! | Call us NOW for Rapid Response to your
3 Plumbing Emergency\!
4 message: false
5 ---

Q: Is there a limit to the length of the string widget?
I have tried using Text widget with same result!

**Describe the bug**
When entering text in title widget: string and publishing, the text is saving in markdown frontmatter over 2 lines in error as shown here:

1 ---
2 title: AFTER HOURS... No Problem\! | Call us NOW for Rapid Response to your
3 Plumbing Emergency\!
4 message: true
5 ---

**To Reproduce**

**Expected behavior**
when saving and publishing, the string should remain on one line as shown here:
1 ---
2 title: AFTER HOURS... No Problem\! | Call us NOW for Rapid Response to your Plumbing Emergency\!
3 message: true
4 ---

**Screenshots**

**Applicable Versions:**
- Netlify CMS version: 2.10.192
- Git provider: GitHub
- OS: mac OS
- Browser version google Chrome: Version 100.0.4896.127

- Node.JS version: v16.14.0

**CMS configuration**
The offending widget in config.yml is:

- label: "Emergency Plumbing"
name: "emergency"
files:
- label: "Emergency Attention Message"
name: "emergency-attention-message"
file: "src/markdown/emergency-attention-message.md"
fields:
- {label: "Attention Message", name: "title", widget: "string"}
- {label: "Show Message", hint: "Toggle switch to Show or Hide attention message", name: "message", widget: "boolean", default: true}

hopefully you can provide some insight into this problem or at least advise me what I am doing wrong!

thanks!

Contributor guide

Open the contributing guide

Research direction

Start with the CMS configuration in config.yml and the generated src/markdown/emergency-attention-message.md file, reproducing the publish flow with the string widget. Compare the saved frontmatter with the expected single-line title, then identify the relevant serialization path and add coverage if the project’s existing tests support it. Done means publishing preserves the title as one logical value without an unintended split.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, yaml
Domain
content
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.