URL inputs

Last modified: September 11th, 2024

A URL input lets your team members add relative, absolute and fully qualified URLs to your data files or the front matter of markup files.

For each input, you can configure how CloudCannon handles empty values. You can also use the general configuration options available for all inputs.

URL#

The URL input provides an editing interface for relative, absolute and fully qualified URLs. CloudCannon shows a preview of the URL when the URL begins with a protocol (http:// or https://).

You can configure a URL input using the type key with the value url. 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:
  associate_link:
    type: url

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

This URL input is called associate_link.

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

cloudcannon.config.json
copied
{
  "_inputs": {
    "associate_link": {
      "type": "url"
    }
  }
}

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

This URL input is called associate_link.

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

Once configured, the URL 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.

blog.md
copied
---
associate_link: http://example.com
---

Content goes here.

Options#

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

cloudcannon.config.yaml
copied
_inputs:
  background:
    type: url
    options:
      empty_type: 
cloudcannon.config.json
copied
{
  "_inputs": {
    "background": {
      "type": "url",
      "options": {
        "empty_type": null
      }
    }
  }
}

URL inputs have the following options available:

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 URL inputs#

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

CloudCannon will interpret any unconfigured input with the key name url or link, or that ends in _url or _link, as a URL input.

data.yml
copied
external_link: https://cloudcannon.com/

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#

Here are some examples of valid values for the key url.

Empty/null value:

  • url:

Any valid string (quoted or unquoted):

  • url: ""
  • url: ''
  • url: example.com
  • url: "example.com"
  • url: 'example.com'
  • url: "https://example.com"

URLs containing : must be surrounded by quotes

Any valid string:

  • url = ""
  • url = ''
  • url = "example.com"
  • url = 'example.com'
  • url = "https://example.com"

Null value:

  • "url": null

Any valid string:

  • "url": ""
  • "url": "example.com"
  • "url": "https://example.com"

Related Articles

Open in a new tab