Skip to content

Field parameter to support adding quotes around field data #3505

@jeremyzilar

Description

@jeremyzilar

Slightly related to #3486

Is your feature request related to a problem? Please describe.

Background: I oversee Digital.gov, a site provides guidance around making better digital services for people in government. All of our websites are built using static site generators (Jekyll, Hugo), and use a mix of Federalist and GitHub to publish the pages.

Currently, most of the edits to our sites are made directly in the GitHub website from people not in our org, but people from around the government.

To make the process of editing fields easier, we are specifying that certain fields always have double quotes wrapped around them, regardless if there is a need for them or not.

For example, in the YML spec, the title field in the example below would not require it to be wrapped in quotes (title: "Introduction to Accessibility"), but because we have many editors and content designers going in to update the text fields, having double quotes around certain fields helps to ensure that the text they add will not break the build. This can be adding a colon, apostrophe, markdown formatting, etc... (title: "NEW: Introduction to Accessibility"). We have found that asking editors to remember to add quotes around an item if it has special chars is not something we coach them on in the workflow.

Here is an example of data fields and text fields 👀

slug: introduction-accessibility
date: 2019-12-04 8:00:00 -0500
title: "Introduction to Accessibility"
deck: ""
summary: "An introduction to accessibility, and why it matters."

Here's the full file

Describe the solution you'd like
We are now making a switch to use Netlify CMS, and we'd like to be able to keep the ability to specify if a field should be automatically wrapped in double-quotes. This could be done by adding an optional parameter to the field you'd want wrapped in quotes (e.g. quotes: true)

Example:

      - label: "Agency Acronym"
        name: "agency"
        widget: "string"
        hint: "e.g. GSA"
        quotes: true
        required: false

When it renders, the field would get wrapped in quotes automatically. Ideally, the field in Netlify CMS would also look for the insertion of double quotes in the field and escape them.

title: "The \"Best\" Introduction to Accessibility"

Thank you for considering this 🌈✨

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions