Defining data allows you to populate select and multiselect inputs. Each data set corresponds to a file or folder in your site files.
By default, CloudCannon does not read the contents of data files during your build. If required, include data with the instructions for your SSG:
specific doc
To include all data sets, add the following to your global configuration file:
data_config: true
{
"data_config": true
}
module.exports = {
data_config: true
};
Include only select data sets with specific keys:
data_config:
authors: true
offices: true
{
"data_config": {
"authors": true,
"offices": true
}
}
module.exports = {
data_config: {
authors: true,
offices: true
}
};
specific doc
To include all data sets, add the following to your global configuration file:
data_config: true
{
"data_config": true
}
module.exports = {
data_config: true
};
Include only select data sets with specific keys:
data_config:
authors: true
offices: true
{
"data_config": {
"authors": true,
"offices": true
}
}
module.exports = {
data_config: {
authors: true,
offices: true
}
};
specific doc
To include data sets with specific keys, add the following to your global configuration file:
data_config:
authors: true
offices: true
{
"data_config": {
"authors": true,
"offices": true
}
}
module.exports = {
data_config: {
authors: true,
offices: true
}
};
specific doc
To include data sets with specific keys, reader parses files and folders listed in data_config
. In the following
example global configuration there are two data sets:
authors
which is read from the contents of a single fileoffices
which is read from the contents of each file in a directory
data_config:
authors:
path: data/authors.csv
offices:
path: data/offices
parser: json
{
"data_config": {
"authors": {
"path": "data/authors.csv"
},
"offices": {
"path": "data/offices",
"parser": "json"
}
}
}
module.exports = {
data_config: {
authors: {
path: "data/authors.csv"
},
offices: {
path: "data/offices",
parser: "json"
}
}
};