I have a Jekyll website with a Netlify CMS admin page. The website supports some different languages, which I have in a _data/languages.yml
file for Jekyll to use. Then in the Netlify backend there is a select
widget with those same languages.
However, this means I have some duplication of this data, both my languages.yml
file and the config.yml
file of Netlify have the same list of languages. So I was wondering, is there a way to only have this list of languages once?
My _data/languages.yml
file looks something like this:
- value: "nl"
label: "NL"
- value: "en"
label: "EN"
- value: "fr"
label: "FR"
- value: "de"
label: "DE"
- value: "ja"
label: "Japanese"
- value: "zh"
label: "Mandarin"
And in the Netlify config.yml
there is:
...
label: 'Language'
name: 'language'
widget: 'select'
options:
- { label: "Dutch", value: "nl" }
- { label: "English", value: "en" }
- { label: "French", value: "fr" }
- { label: "German", value: "de" }
- { label: "Japanese", value: "ja" }
- { label: "Chinese", value: "zh" }
...
What I thought of (and why it doesn't work):
- Use liquid tags inside the
config.yml
-> This is not supported, and Netlify just complains that theconfig.yml
now starts with--- ---
(the frontmatter) - Include the
languages.yml
insideconfig.yml
-> You can't "import" yml files in another one sadly
Are there any other ways that do work?