You can split your CloudCannon Configuration File into multiple files for easier maintenance. For more information, please read our documentation on why you might split your Configuration File, and best practices for splitting your Configuration File.
These instructions assume your Site uses Unified Configuration.
To split your CloudCannon Configuration File:
- Navigate to your File Browser and open your CloudCannon Configuration File in the Source Editor, or open it in your local development environment.
- Identify the configuration key you want to split out into a new file (e.g., a Collection under
collections_config). - Copy all the configuration content under the key to a new file with the appropriate
.cloudcannon.[].ymlfile extension. - Reference the location of the new Configuration File (relative to the root of your repository) in the original Configuration File using the appropriate
*_from_globkey. If the original Configuration File is not your main CloudCannon Configuration File (i.e.,cloudcannon.config.yml), ensure that every Configuration File ultimately connects back to your main Configuration File using*_from_globkeys. - Save the changes to your Site.
Whenever you load your Site or update a Configuration File, CloudCannon will merge your configuration and apply it to your Site.
Configuration keys#
CloudCannon allows you to split the specific configuration keys into separate Configuration Files. Here is an example of two Configuration Files using some of the most commonly used keys for splitting configuration.
source: /
collections_config_from_glob:
- /.cloudcannon/collections/*.cloudcannon.collections.yml
_inputs_from_glob:
- /.cloudcannon/inputs/*.cloudcannon.inputs.yml
_structures_from_glob:
- /.cloudcannon/structures/*.cloudcannon.structures.yml
{
"source": "/",
"collections_config_from_glob": [
"/.cloudcannon/collections/*.cloudcannon.collections.yml"
],
"_inputs_from_glob": [
"/.cloudcannon/inputs/*.cloudcannon.inputs.yml"
],
"_structures_from_glob": [
"/.cloudcannon/structures/*.cloudcannon.structures.yml"
]
}posts:
path: src/content/
schemas_from_glob:
- /.cloudcannon/schemas/blogPost.cloudcannon.schemas.yml
- /.cloudcannon/schemas/companyAnnouncement.cloudcannon.schemas.yml
- /.cloudcannon/schemas/caseStudy.cloudcannon.schemas.yml
{
"posts": {
"path": "src/content/",
"schemas_from_glob": [
"/.cloudcannon/schemas/blogPost.cloudcannon.schemas.yml",
"/.cloudcannon/schemas/companyAnnouncement.cloudcannon.schemas.yml",
"/.cloudcannon/schemas/caseStudy.cloudcannon.schemas.yml"
]
}
}For a complete list of configuration keys available for the CloudCannon Configuration File, please read our Configuration File reference documentation.
These keys configure which files CloudCannon should use for Site configuration.
This key defines globs that filter which files CloudCannon should use for Collection configuration. Values in this array are relative to the root of your repository (i.e., /, not the value of source) and must end in the file extension .cloudcannon.collections.yml. You can use this key anywhere you would use the collections_config key.
This key has no default.
Show exampleHide example
In this example, each Collection has its own Configuration File in the .cloudcannon/collections/ folder. The value of the collections_config_from_glob key tells CloudCannon to use all files in that folder that match the glob *.cloudcannon.collections.yml.
collections_config_from_glob:
- /.cloudcannon/collections/*.cloudcannon.collections.yml
{
"collections_config_from_glob": [
"/.cloudcannon/collections/*.cloudcannon.collections.yml"
]
}posts:
path: content/posts
icon: event
{
"posts": {
"path": "content/posts",
"icon": "event"
}
}This key defines globs that filter which files CloudCannon should use for Schema configuration. Values in this array are relative to the root of your repository (i.e., /, not the value of source) and must end in the file extension .cloudcannon.schemas.yml. You can use this key anywhere you would use the schemas key.
This key has no default.
Show exampleHide example
In this example, we have several Schemas Configuration Files in the .cloudcannon/schemas/ folder. The value of the schemas_from_glob key tells CloudCannon to use all files in that folder that match the glob *.cloudcannon.schemas.yml except for pages.cloudcannon.schemas.yml due to the negative glob.
posts:
path: content/posts
icon: event
schemas_from_glob:
- /.cloudcannon/schemas/*.cloudcannon.schemas.yml
- '!/.cloudcannon/schemas/pages.cloudcannon.schemas.yml'
{
"posts": {
"path": "content/posts",
"icon": "event",
"schemas_from_glob": [
"/.cloudcannon/schemas/*.cloudcannon.schemas.yml",
"!/.cloudcannon/schemas/pages.cloudcannon.schemas.yml"
]
}
}This key defines globs that filter which files CloudCannon should use for Input configuration. Values in this array are relative to the root of your repository (i.e., /, not the value of source) and must end in the file extension .cloudcannon.inputs.yml. You can use this key anywhere you would use the _inputs key in the configuration cascade.
This key has no default.
Show exampleHide example
In this example, we have several Input Configuration Files in the .cloudcannon/inputs/ folder, with each file containing multiple Input definitions. The value of the _inputs_from_glob key tells CloudCannon to only use the seo.cloudcannon.inputs.yml and blog-details.cloudcannon.inputs.yml files in that folder.
collections_config:
posts:
path: content/posts
icon: event
inputs_from_glob:
- /.cloudcannon/inputs/seo.cloudcannon.inputs.yml
- /.cloudcannon/inputs/blogDetails.cloudcannon.inputs.yml
{
"collections_config": {
"posts": {
"path": "content/posts",
"icon": "event",
"inputs_from_glob": [
"/.cloudcannon/inputs/seo.cloudcannon.inputs.yml",
"/.cloudcannon/inputs/blogDetails.cloudcannon.inputs.yml"
]
}
}
}seo_title:
type: text
options:
required: true
max_length: 50
seo_description:
type: textarea
options:
show_count: true
required: true
max_length: 125
seo_image:
type: image
options:
path:
uploads: images
accepts_mime_types:
- image/png
- image/jpeg
required: true
pattern: (?i)\.(jpe?g|png)$
pattern_message: Please select a JPG or PNG image file
{
"seo_title": {
"type": "text",
"options": {
"required": true,
"max_length": 50
}
},
"seo_description": {
"type": "textarea",
"options": {
"show_count": true,
"required": true,
"max_length": 125
}
},
"seo_image": {
"type": "image",
"options": {
"path": {
"uploads": "images"
},
"accepts_mime_types": [
"image/png",
"image/jpeg"
],
"required": true,
"pattern": "(?i)\\.(jpe?g|png)$",
"pattern_message": "Please select a JPG or PNG image file"
}
}
}This key defines globs that filter which files CloudCannon should use for Structure configuration. Values in this array are relative to the root of your repository (i.e., /, not the value of source) and must end in the file extension .cloudcannon.structures.yml. You can use this key anywhere you would use the _structures key in the configuration cascade. Please see our documentation on values_from_glob for defining individual Structure values in a split Configuration File.
This key has no default.
Show exampleHide example
In this example, we have several Structure Configuration Files in the .cloudcannon/structures/ folder. The value of the _structures_from_glob key tells CloudCannon to use the staffMembers.cloudcannon.structures.yml file in that folder.
_structures_from_glob:
- /.cloudcannon/structures/staffMembers.cloudcannon.structures.yml
{
"_structures_from_glob": [
"/.cloudcannon/structures/staffMembers.cloudcannon.structures.yml"
]
}staff:
style: modal
values:
- label: Employee
value:
name:
job_description:
profile_picture:
- label: Manager
value:
name:
job_description:
profile_picture:
url:
{
"staff": {
"style": "modal",
"values": [
{
"label": "Employee",
"value": {
"name": null,
"job_description": null,
"profile_picture": null
}
},
{
"label": "Manager",
"value": {
"name": null,
"job_description": null,
"profile_picture": null,
"url": null
}
}
]
}
}This key defines globs that filter which files CloudCannon should use for Structure value configuration. Values in this array are relative to the root of your repository (i.e., /, not the value of source) and must end in the file extension .cloudcannon.structure-value.yml (note the singular form of "value"). You can use this key anywhere you would use the _structures.*.values key. Please see our documentation on structures_from_glob for defining a Structure in a split Configuration File.
This key has no default.
Show exampleHide example
In this example, the staff Array Input uses inline Structure values from the main Configuration File and also references another value from the boardMember.cloudcannon.structure_value.yml in the /.cloudcannon/structures/ folder.
_inputs:
staff:
type: array
options:
structures:
values_from_glob: /.cloudcannon/structures/boardMember.cloudcannon.structure-value.yml
values:
- label: Employee
value:
name:
title:
profile_picture:
- label: Manager
value:
name:
title:
profile_picture:
url:
{
"_inputs": {
"staff": {
"type": "array",
"options": {
"structures": null,
"values_from_glob": "/.cloudcannon/structures/boardMember.cloudcannon.structure-value.yml",
"values": [
{
"label": "Employee",
"value": {
"name": null,
"title": null,
"profile_picture": null
}
},
{
"label": "Manager",
"value": {
"name": null,
"title": null,
"profile_picture": null,
"url": null
}
}
]
}
}
}
}label: Board
value:
name:
title:
profile_picture:
url:
description:
{
"label": "Board",
"value": {
"name": null,
"title": null,
"profile_picture": null,
"url": null,
"description": null
}
}This key defines globs that filter which files CloudCannon should use for Snippet configuration. Values in this array are relative to the root of your repository (i.e., /, not the value of source) and must end in the file extension .cloudcannon.snippets.yml. You can use this key anywhere you would use the _snippets key in the configuration cascade.
This key has no default.
Show exampleHide example
In this example, each Custom Snippet has its own Configuration File in the .cloudcannon/snippets/ folder. The value of the _snippets_from_glob key tells CloudCannon to use the callout.cloudcannon.snippets.yml file in that folder.
_snippets_imports:
eleventy_liquid: true
_snippets_from_glob:
- /.cloudcannon/snippets/callout.cloudcannon.snippets.yml
{
"_snippets_imports": {
"eleventy_liquid": true
},
"_snippets_from_glob": [
"/.cloudcannon/snippets/callout.cloudcannon.snippets.yml"
]
}callout:
template: eleventy_liquid_include
inline: false
preview:
text: Callout
definitions:
include_name: callout
named_args:
- source_key: type
editor_key: label
type: string
- editor_key: message
type: string
_inputs:
label:
type: select
options:
values:
- info
- warning
- error
{
"callout": {
"template": "eleventy_liquid_include",
"inline": false,
"preview": {
"text": "Callout"
},
"definitions": {
"include_name": "callout",
"named_args": [
{
"source_key": "type",
"editor_key": "label",
"type": "string"
},
{
"editor_key": "message",
"type": "string"
}
]
},
"_inputs": {
"label": {
"type": "select",
"options": {
"values": [
"info",
"warning",
"error"
]
}
}
}
}
}This key defines globs that filter which files CloudCannon should use for Collection configuration. Values in this array are relative to the root of your repository (i.e., /, not the value of source) and must end in the file extension .cloudcannon.snippets-imports.yml. You can use this key anywhere you would use the _snippets_imports key in the configuration cascade.
This key has no default.
Show exampleHide example
In this example, we have several Snippet Configuration Files in the .cloudcannon/snippets/ folder. The value of the _snippets_import_from_glob key tells CloudCannon all files in that folder that match the glob *.cloudcannon.snippets-import.yml.
_snippets_imports_from_glob:
- /.cloudcannon/snippets/*.cloudcannon.snippets-imports.yml
{
"_snippets_imports_from_glob": [
"/.cloudcannon/snippets/*.cloudcannon.snippets-imports.yml"
]
}mdx: true
docusaurus_mdx:
exclude:
- docusaurus_mdx_truncate
{
"mdx": true,
"docusaurus_mdx": {
"exclude": [
"docusaurus_mdx_truncate"
]
}
}This key defines globs that filter which files CloudCannon should use for configuring Rich Text formatting. Values in this array are relative to the root of your repository (i.e., /, not the value of source) and must end in the file extension .cloudcannon.editables.yml. You can use this key anywhere you would use the _editables key in the configuration cascade.
This key has no default.
Show exampleHide example
In this example, we have several WYSIWYG Toolbar Configuration Files in the .cloudcannon/editables/ folder, with each file containing multiple definitions. The value of the _editables_from_glob key tells CloudCannon all files in that folder that match the glob *.cloudcannon.editables.yml.
_editables_from_glob:
- /.cloudcannon/editables/*.cloudcannon.editables.yml
{
"_editables_from_glob": [
"/.cloudcannon/editables/*.cloudcannon.editables.yml"
]
}text:
bold: true
italic: true
underline: true
block:
format: p h3
undo: true
redo: true
link:
bold: true
italic: true
underline: true
{
"text": {
"bold": true,
"italic": true,
"underline": true
},
"block": {
"format": "p h3",
"undo": true,
"redo": true
},
"link": {
"bold": true,
"italic": true,
"underline": true
}
}Common errors#
If you have any questions about configuring your Site on CloudCannon, don't hesitate to contact our friendly support team.
Site configuration is not loading#
- Check that the glob pattern in your
*_from_globkey correctly matches the name of your Configuration File. - Check that the value of your
*_from_globkey references the correct file extension (e.g.,collections_config_from_globmust reference a file with the.cloudcannon.collections.ymlextension). - Ensure that the value of
*_from_globis relative to the root repository, not the source directory. - Verify that your Site uses Unified Configuration.
One configuration is unexpectedly overwriting another#
- Check where you have defined you configuration. If you have defined a configuration key multiple times at the same level of the configuration cascade, CloudCannon will preferentially use the configuration defined in files later in the import order (i.e., inline configuration first, followed by configuration from other files in Unicode order).
Array items are missing#
- Check that the glob pattern in your
*_from_globkey correctly matches the name of your Configuration File. - Array items referenced in another Configuration File using a
*_from_globkey are appended to any array items defined in your main Configuration File. Check all array items are present in the files referenced by yourvalues_from_globkey.