I am currently trying to build a “Settings” collection, where I would like to have an item “Site Settings”. Here I want to show some common fields like, “site title”, “site description”, “email”, “facebook”, “instagram”, etc.
I have this info on the siteMetadata: {} from the gatsby.config file.
Some one knows how I can get this data from the file and show it on the Netlify CMS? How do I have to build the my /admin/config.yml file?
- name: "settings"
label: "Settings"
delete: false # Prevent users from deleting documents in this collection
editor:
preview: false
files:
- file: "content/settings/global.yml"
label: "Global Settings"
name: "global-settings"
I have to change the file: “content/settings/global.yml”, but don’t know if it is possible.
Hi @ositaka, how is the global.yml file structured? Can you give an example of its content?
You should be able to define fields matching its content, then use GraphQL in Gatsby to query the data.
Thanks for sharing, there is actually another way to do it. You could extract that part into a separate JS/JSON file and use CMS manual initialization:
Then you should be able to import that data both to Gatsby config and the CMS config.