Text inputs

Last modified: September 11th, 2024

A text input lets your team members add plain text to your data files or front matter.

There are four types of Text input:

  • Text
  • Textarea
  • Email
  • Disabled

For each input, you can configure how CloudCannon handles null values. For Textarea inputs, you can configure a character counter. You can also use the general configuration options available for all inputs.

Text#

The Text input provides a simple editing interface for plain text.

A screenshot of the Text input in the Data Editor.

You can configure a Text input using the type key with the value text. Define the type key under your input key name within _inputs. For more information, please read our documentation on configuring your inputs.

cloudcannon.config.yaml
copied
_inputs:
  blog_title:
    type: text

All inputs are defined under the _inputs key, regardless of where they are in the configuration cascade.

This Text input is called blog_title.

The value of the type key determines the input type. This is a text input.

cloudcannon.config.json
copied
{
  "_inputs": {
    "blog_title": {
      "type": "text"
    }
  }
}

All inputs are defined under the _inputs key, regardless of where they are in the configuration cascade.

This Text input is called blog_title.

The value of the type key determines the input type. This is a text input.

Once configured, the Text input will appear in the Data Editor or sidebar of the Visual or Content Editor when you add it to a data file or the front matter of a markup file.

about.md
copied
---
blog_title: The benefits of static sites
---

Page content goes here.

Textarea#

The Textarea input provides a resizable editing interface for plain text.

A screenshot of the Textarea input in the Data Editor, with a resizable text box.

You can configure a Textarea input using the type key with the value textarea. Define the type key under your input key name within _inputs. For more information, please read our documentation on configuring your inputs.

cloudcannon.config.yaml
copied
_inputs:
  page_description:
    type: textarea

All inputs are defined under the _inputs key, regardless of where they are in the configuration cascade.

This Textarea input is called page_description.

The value of the type key determines the input type. This is a textarea Text input.

cloudcannon.config.json
copied
{
  "_inputs": {
    "page_description": {
      "type": "textarea"
    }
  }
}

All inputs are defined under the _inputs key, regardless of where they are in the configuration cascade.

This Textarea input is called page_description.

The value of the type key determines the input type. This is a textarea Text input.

Once configured, the Textarea input will appear in the Data Editor or sidebar of the Visual or Content Editor when you add it to a data file or the front matter of a markup file.

about.md
copied
---
page_description: This page is about how to configure your inputs.
---

Page content goes here.

Email#

The Email input provides an editing interface for plain text with an email icon for context.

A screenshot of the Email input in the Data Editor.

You can configure an Email input using the type key with the value email. Define the type key under your input key name within _inputs. For more information, please read our documentation on configuring your inputs.

cloudcannon.config.yaml
copied
_inputs:
  contact_address:
    type: email

All inputs are defined under the _inputs key, regardless of where they are in the configuration cascade.

This Email input is called contact_address.

The value of the type key determines the input type. This is a email Text input.

cloudcannon.config.json
copied
{
  "_inputs": {
    "contact_address": {
      "type": "email"
    }
  }
}

All inputs are defined under the _inputs key, regardless of where they are in the configuration cascade.

This Email input is called contact_address.

The value of the type key determines the input type. This is a email Text input.

Once configured, the Email input will appear in the Data Editor or sidebar of the Visual or Content Editor when you add it to a data file or the front matter of a markup file.

about.md
copied
---
contact_address: support@cloudcannon.com
---

Page content goes here.

Disabled#

The Disabled input is a single line of read-only plain text. The field for this input appears grayed-out, and you can only edit the value in the Source Editor.

A screenshot of a disabled Text input in the Data Editor.

You can configure a Disabled input using the type key with the value disabled. Define the type key under your input key name within _inputs. For more information, please read our documentation on configuring your inputs.

cloudcannon.config.yaml
copied
_inputs:
  author:
    type: disabled

All inputs are defined under the _inputs key, regardless of where they are in the configuration cascade.

This Disabled input is called author.

The value of the type key determines the input type. This is a disabled Text input.

cloudcannon.config.json
copied
{
  "_inputs": {
    "author": {
      "type": "disabled"
    }
  }
}

All inputs are defined under the _inputs key, regardless of where they are in the configuration cascade.

This Disabled input is called author.

The value of the type key determines the input type. This is a disabled Text input.

Once configured, the Disabled input will appear in the Data Editor or sidebar of the Visual or Content Editor when you add it to a data file or the front matter of a markup file.

about.md
copied
---
author: Karen Key
---

Page content goes here.

Options#

You can configure Text inputs using the options key under your input key, inside of _inputs.

cloudcannon.config.yaml
copied
_inputs:
  seo_description:
    type: textarea
    options:
      show_count: true
      empty_type: 
cloudcannon.config.json
copied
{
  "_inputs": {
    "seo_description": {
      "type": "textarea",
      "options": {
        "show_count": true,
        "empty_type": null
      }
    }
  }
}

Text inputs have the following options available:

show_count — Boolean#

This key toggles a character counter.

Available for Textarea input only.

empty_type — string#

This key determines how CloudCannon handles an empty value. This key does not apply to existing empty values.

Value must be one of the following:

  • string - an empty value for this input will be stored as "".
  • null - an empty value for this input will be stored as a null value (default). This does not apply to TOML files.

Unconfigured Text inputs#

In some cases, CloudCannon can still detect a Text input even if you have not configured it.

CloudCannon will interpret any unconfigured input with the key name:

  • textarea or description, or that ends in _textarea or _description, as a Textarea input.
  • email or email_address, or that ends in _email or _email_address, as a Textarea input.
data.yml
copied
image_description: /images/forest.jpeg

CloudCannon will interpret any unconfigured input with a string value as a Text input, provided that the key name does not match the naming convention for any other input type.

This behavior is convenient if you have simple inputs, or do not want to configure inputs. It is also beneficial for new websites on CloudCannon where you have yet to create any CloudCannon-specific configuration.

We recommend configuring your inputs for greater control over their functionality and appearance.

Valid values#

Text inputs can have multiple valid values for empty, single line, and multiline content. Here are some examples of valid values for the key text. These work for Text, Textarea, and Email inputs

Empty/null value:

  • text:

Any valid string (quoted or unquoted):

  • text: ""
  • text: ''
  • text: any string
  • text: "any string"
  • text: 'any string'

Any valid multiline string:

  • text: >
    multiline string
  • text: >-
    multiline string
  • text: >+
    multiline string
  • text: |
    multiline string
  • text: |-
    multiline string
  • text: |+
    multiline string

Any valid string:

  • text = ""
  • text = "any string"

Any valid escaped string:

  • text = ''
  • text = 'any string (literal)'

Any valid multiline string:

  • text = """
    multiline string"""
  • text = """\
    multiline string (trimmed) \
    """
  • text = '''
    literal multiline string'''

Null value:

  • "text": null

Any valid string:

  • "text": ""
  • "text": "any string"

Any valid multiline string:

  • "text": "multiline \n string"

Open in a new tab