A URL input is an editing interface for relative, absolute, and fully qualified URLs. By configuring your inputs, you can customize the appearance and functionality for a better editing experience.


These instructions assume that you know where in the configuration cascade you want to configure your input. For more information, please read our documentation on URL inputs, inputs in general, and the configuration cascade.
To configure a URL input:
- Open your website files in your local development environment, or log in to CloudCannon and select the Site for which you want to configure your input.
- Navigate to the location in the configuration cascade where you want to configure your input. This can be the root of your CloudCannon Configuration File, within the
collections_config.*
key in your CloudCannon Configuration File, a Schema file, a markup file, or any where you configure a Structure. - Identify the
_inputs
key, or create one at that level of the configuration cascade. - Add an input name key for your input under the
_inputs
key (a.k.a.,_inputs.*
). We recommend naming your input something simple that indicates the function or context. - Add the
type
key under your input name key, with the valueurl
. - (Optional.) Add any other general configuration keys (e.g.,
label
,comment
,context
) under your input name key. - (Optional.) Add any specific configuration keys under
_inputs.*.options
(e.g.,pattern
,pattern_message
).
CloudCannon will now apply this input configuration to all markup files that use your input name key, without needing to save your configuration. This allows you to make changes to your input configuration and see those changes affect inputs live.
When you are happy with your input configuration, you must save your input configuration.
_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.
{
"_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.
When you add your input key name to a data or markup file, your configured URL input will appear in the Data Editor, Visual Editor, or Content Editor.
---
associate_link: http://example.com
---
Blog content goes here.
Input configuration options#
General configuration options are available for all input types. You can define the label, comment, and context box for your URL input, whether it is hidden or disabled, and how CloudCannon should handle configuration at multiple levels of the configuration cascade.
Specific configuration options for URL inputs include configuring how CloudCannon handles empty values and which URL input options are visible. You can also add input validation to require a value, specify the minimum and maximum value length, or match a regular expression.
Here is an example of a URL input using some of the most commonly used configuration keys.
_inputs:
external_link:
type: url
label: External Link
comment: Enter a URL to link to an external resource
options:
required: true
pattern: ^https?\:\/\/
pattern_message: Please use a URL starting with https://
empty_type:
{
"_inputs": {
"external_link": {
"type": "url",
"label": "External Link",
"comment": "Enter a URL to link to an external resource",
"options": {
"required": true,
"pattern": "^https?\\:\\/\\/",
"pattern_message": "Please use a URL starting with https://",
"empty_type": null
}
}
}
}
For a complete list of configuration keys available for inputs please read our inputs reference documentation.
These keys configure the appearance and functionality of URL inputs in CloudCannon.
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.
This key toggles whether the "Link to a file" option for this URL input is visible.
Setting this key to true
will hide this option.
By default, this key is false (i.e., the options visible).
This key toggles whether the "Link to a page" option for this URL input is visible.
Setting this key to true
will hide this option.
By default, this key is false (i.e., the options visible).
This key toggles whether the "Link to an email address" option for this URL input is visible.
Setting this key to true
will hide this option.
By default, this key is false (i.e., the options visible).
This key toggles whether CloudCannon requires this Input to have a value. If set to true
, CloudCannon will require you to enter a value to save your changes, or discard your unsaved changes.
By default, this key is false
(i.e, CloudCannon does not require this Input to have a value).
This key is available for Array, Boolean, Code, Color, Date and Time, File, Number, Object, Select and Multiselect, Text, Rich Text, and URL Inputs.
Show exampleHide example
In this example, we want to require our team to enter an author
value for markup files with this Input.
_inputs:
author:
type: text
comment: Enter the name of the author for this blog post.
options:
required: true
{
"_inputs": {
"author": {
"type": "text",
"comment": "Enter the name of the author for this blog post.",
"options": {
"required": true
}
}
}
}
This key defines the maximum string length, in characters, that CloudCannon will allow in an Input. When configured, CloudCannon will warn you when an Input value is too long. If the Input already contains a longer value, CloudCannon will require you to remove characters until the Input contains a valid string to save your changes, or discard your unsaved changes.
Value can be any non-negative integer. If this key is set to 0
, CloudCannon requires the Input to be empty. If options.min_length
is also configured, this key cannot be a smaller number.
This key has no default.
This key is available for Code, Color, File, Select, Text, Rich Text, and URL Inputs. To use this key in a Select Input, allow_create
must be set to true
.
Show exampleHide example
In this example, we want our team to enter a blog description using the Rich Text seo_description
Input. This Input limits you to a maximum of 125 characters.
_inputs:
seo_description:
type: markdown
comment: Enter a brief description of this blog.
options:
max_length: 125
min_length: 25
{
"_inputs": {
"seo_description": {
"type": "markdown",
"comment": "Enter a brief description of this blog.",
"options": {
"max_length": 125,
"min_length": 25
}
}
}
}
This key defines the minimum string length, in characters, that CloudCannon will allow in an Input. When configured, CloudCannon will warn you when an Input value is too short. If the Input already contains a shorter value, CloudCannon will require you to add characters until the Input contains a valid string to save your changes, or discard your unsaved changes.
Value can be any positive integer. If options.max_length
is also configured, this key cannot be a greater number.
This key has no default.
This key is available for Code, Color, File, Select, Text, Rich Text, and URL Inputs. To use this key in a Select Input, allow_create
must be set to true
.
Show exampleHide example
In this example, we want our team to enter a blog description using the Rich Text seo_description
Input. This Input requires a minimum of 25 characters.
_inputs:
seo_description:
type: markdown
comment: Enter a brief description of this blog.
options:
max_length: 125
min_length: 25
{
"_inputs": {
"seo_description": {
"type": "markdown",
"comment": "Enter a brief description of this blog.",
"options": {
"max_length": 125,
"min_length": 25
}
}
}
}
This key defines a regular expression that the Input value must match. When configured, CloudCannon will require you to enter a value that matches the REGEX pattern. If the Input already contains an invalid value, CloudCannon will require you to enter a valid string to save your changes, or discard your unsaved changes.
Value must be a valid REGEX string.
This key has no default.
This key is available for Code, Color, File, Select, Text, Rich Text, and URL Inputs. To use this key in a Select Input, allow_create
must be set to true
.
Show exampleHide example
In this example, we want our team to add an email address to the contact_email
Input using the correct email format.
_inputs:
contact_email:
type: email
options:
pattern: '[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}'
pattern_message: Please use the format ___@___.__
{
"_inputs": {
"contact_email": {
"type": "email",
"options": {
"pattern": "[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\\.[a-zA-Z]{2,}",
"pattern_message": "Please use the format ___@___.__"
}
}
}
}
This key defines the message that explains which regular expression an Input will accept. This key requires you to define options.pattern
.
This key has no default.
This key is available for Code, Color, File, Select, Text, Rich Text, and URL Inputs.
Show exampleHide example
In this example, we prompt our team to use the correct email format in the contact_email
Input using a pattern message.
_inputs:
contact_email:
type: email
options:
pattern: '[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}'
pattern_message: Please use the format ___@___.__
{
"_inputs": {
"contact_email": {
"type": "email",
"options": {
"pattern": "[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\\.[a-zA-Z]{2,}",
"pattern_message": "Please use the format ___@___.__"
}
}
}
}
This key toggles whether CloudCannon shows the "Upload a new file" option in the "Add URL" dropdown menu on a URL Input or "Add file" dropdown menu on a File Input. When set to true
, the "Upload a new file" option is not available.
By default, this key is false
(i.e., users can upload files).
Show exampleHide example
In this example, we have a logo
Image input where users can only select existing images but cannot upload new ones.
_inputs:
logo:
type: image
label: Company Logo
options:
disable_upload_file: true
{
"_inputs": {
"logo": {
"type": "image",
"label": "Company Logo",
"options": {
"disable_upload_file": true
}
}
}
}
This key toggles whether you can type in the text field of a File Input or URL Input. When set to true
, you cannot manually type or paste values into the input text field.
By default, this key is false
(i.e., users can type directly into the input field).
Show exampleHide example
In this example, we have a document
File input where users must select files through the file browser and cannot manually type file paths.
_inputs:
document:
type: document
label: PDF Document
options:
disable_direct_input: true
{
"_inputs": {
"document": {
"type": "document",
"label": "PDF Document",
"options": {
"disable_direct_input": true
}
}
}
}
This key toggles whether the "Add" button in the top right of the File browser modal is available, after selecting the "Link to existing file" option in the "Add URL" dropdown menu on a URL Input or "Add file" dropdown menu on a File Input. When set to true
, the "Link to existing file" option is not available.
By default, this key is false
(i.e., users can upload files in the File browser modal).
Show exampleHide example
In this example, we have a background_image
Image input where users can upload files using the "Upload a new file" option in the "Add URL" dropdown menu on a URL Input or "Add file" dropdown menu on a File Input, but not from within the File browser modal.
_inputs:
background_image:
type: image
label: Background Image
options:
disable_upload_file_in_file_browser: true
{
"_inputs": {
"background_image": {
"type": "image",
"label": "Background Image",
"options": {
"disable_upload_file_in_file_browser": true
}
}
}
}
This key toggles whether CloudCannon shows the "Link to a page" option in the "Add URL" dropdown menu on a URL Input. When set to true
, the "Link to a page" option is not available.
By default, this key is false
(i.e., file linking and upload options are visible).
Show exampleHide example
In this example, we have a document_url
URL input where users can only enter URLs manually and cannot link to files or upload new files.
_inputs:
document_url:
type: url
label: Document URL
comment: Enter the URL to an external document
options:
hide_link_to_file: true
{
"_inputs": {
"document_url": {
"type": "url",
"label": "Document URL",
"comment": "Enter the URL to an external document",
"options": {
"hide_link_to_file": true
}
}
}
}
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"
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.
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.