Enhancement: Use data files for choices
See original GitHub issueIs your feature request related to a problem? Please describe.
Data files can be set up to store things like author information (e.g. name, slug, url), but if you want to use this information in your front matter as a dropdown you have to set up this data in duplicate as choices
to a choice
field in frontMatter.taxonomy.contentTypes
.
Describe the solution you’d like
Add an option to use data files as the source for choice
fields with key/value mapping.
Describe alternatives you’ve considered I don’t see any alternatives other than setting it up in duplicate or just manually entering the details instead of a choice dropdown.
Additional context For example set up an authors data file:
"frontMatter.data.files": [
{
"id": "authors",
"title": "Authors",
"file": "[[workspace]]/data/authors.json",
"fileType": "json",
"labelField": "name",
"schema": {
"title": "Authors",
"type": "object",
"required": [
"slug",
"name"
],
"properties": {
"slug": {
"type": "string",
"title": "Slug"
},
"name": {
"type": "string",
"title": "Name"
},
"url": {
"type": "string",
"title": "URL"
}
}
}
}
]
In the field configuration to store an ID/slug but display a name:
{
"title": "Author",
"name": "author-slug",
"type": "choice",
"dataSource": "authors",
"key": "slug",
"value": "name"
}
Or for displaying/storing only a string:
{
"title": "Author",
"name": "author-slug",
"type": "choice",
"dataSource": "authors",
"value": "name"
}
Issue Analytics
- State:
- Created a year ago
- Comments:6 (4 by maintainers)
Top GitHub Comments
That’s great news! I’ll check it out ASAP.
It will be release in v7.3.0