As of October 2024, this documentation is only applicable to Sites using Unified Configuration. For Sites that have not migrated to Unified Configuration, please read the documentation on our non-unified documentation website.
You can use data files and folders to populate your Select and Multiselect inputs. Using a data file or folder to populate your value options is useful when you want your team members to be able to edit the available options.
Data files/folders (i.e., data_config) are different to fixed data sets (i.e., _select_data).
For more information about fixed data sets, please read our documentation on Select and Multiselect inputs.
You can define your data files and folder in the CloudCannon configuration file under the data_config key.
To define a data file or folder:
- Navigate to your CloudCannon configuration file.
- Identify the
data_configkey at the root level of your configuration file, or add it if the key is not present. - Enter a key name for your data nested within the
data_configkey. - Add the
pathkey within your data key and define the filepath to your data file or folder. - Save your changes.
Your data file or folder is now available for Select and Multiselect inputs configured with this data key.
data_config:
authors:
path: data/authors.csv
offices:
path: data/offices{
"data_config": {
"authors": {
"path": "data/authors.csv"
},
"offices": {
"path": "data/offices"
}
}
}Configure all data files or folders under the data_config key in your CloudCannon configuration file.
Select and Multiselect inputs which use the authors key are populated by the contents of the authors.csv file.
Select and Multiselect inputs which use the offices key are populated by the contents of each file in the offices folder.
Options#
Your data configuration has the following options available:
This key defines which file or folder data in your Site is available to populate Select Inputs.
Show examplesHide examples
In this example, we have configured data config to make data files available for Select Inputs and Multiselect Inputs.
data_config:
authors:
path: data/authors.csv
offices:
path: data/offices{
"data_config": {
"authors": {
"path": "data/authors.csv"
},
"offices": {
"path": "data/offices"
}
}
}Configure all data files or folders under the data_config key in your CloudCannon configuration file.
Select Inputs and Multiselect Inputs which use the authors key are populated by the contents of the authors.csv file.
Select Inputs and Multiselect Inputs which use the offices key are populated by the contents of each file in the offices folder.
This key defines what data sets are available to populate Select Inputs.
Appears in: data_config.
Show examplesHide examples
In this example, we have configured data config entries for both a CSV file and a folder of files.
data_config:
authors:
path: data/authors.csv
offices:
path: data/offices{
"data_config": {
"authors": {
"path": "data/authors.csv"
},
"offices": {
"path": "data/offices"
}
}
}Configure all data files or folders under the data_config key in your CloudCannon configuration file.
Select Inputs and Multiselect Inputs which use the authors key are populated by the contents of the authors.csv file.
Select Inputs and Multiselect Inputs which use the offices key are populated by the contents of each file in the offices folder.
This key defines the path to a file or folder of files containing data.
Appears in: data_config.*.
Show examplesHide examples
In this example, we have configured data config paths for both a CSV file and a folder of files.
data_config:
authors:
path: data/authors.csv
offices:
path: data/offices{
"data_config": {
"authors": {
"path": "data/authors.csv"
},
"offices": {
"path": "data/offices"
}
}
}Configure all data files or folders under the data_config key in your CloudCannon configuration file.
Select Inputs and Multiselect Inputs which use the authors key are populated by the contents of the authors.csv file.
Select Inputs and Multiselect Inputs which use the offices key are populated by the contents of each file in the offices folder.