I have data in my _config.yml
file. This data I want to be displayed in the UI. When I use this:
- name: info1
label: Information 1
editor:
preview: false
delete: false
files:
- label: Information
name: info
file: /_config.yml
fields:
- {label: street, name: "location", widget: string}
- {label: phone, name: "phone", widget: string}
- {label: E-mail, name: "email", widget: string}
I do have the data of street, phone, and email available to being edited by the client in the CMS.
But when I use the widget Object (because I want to organize the fields in a better way), so I use this:
- name: info
label: Información
editor:
preview: false
delete: false
files:
- label: Datos de la Empresa
name: config
file: /_config.yml
fields:
- label: Ubicación
name: info
widget: object
fields:
- {label: street, name: "location", widget: string}
- {label: phone, name: "phone", widget: string}
- {label: E-mail, name: "email", widget: string}
I don’t have the data in the CMS, all the street, phone, and email fields are empty.
What can I do to solve this display issue?
Your data should match your admin config for it to show up. _config.yml
should look like this with that last setup:
info:
location: 'Amsterdam'
phone: '00312012345678'
email: 'email@provider.com'
1 Like
Thanks, I can track this if there is any difference, however, one thing I didn’t mention is that I use several xxxx.yml
files. So I pull from the data.yml
one type of info. Effectively I get data from it, but the values that has widget: object
in the config.yml
file are the only ones that doesn’t appear in the UI.
Which site generator are you using? If it’s Gatsby then I can help, otherwise you can read here: https://www.netlifycms.org/docs/customization/
I think the most important thing for the widget content to show in the preview panel is the entry.getIn() part.
I’m using jekyll. I will go over the documentation. Perhaps is an error in the markdown (in the .yml
file) or in the config.yml
file?
Can you paste an example file that isn’t displaying correctly in the CMS?
The code above from the post is the source I have now, until I get to work again. If elements in the CMS defined as an object via widget, displays the data contains in the _config.yml
if this is true, I may have a typo or something. I went over the documentation week ago, but I didn’t find an answer, any leads are very appreciate
The code above is your config. That is not what I’m talking about. I need you to paste a content file that you expect to display properly in the CMS, but is not.
Sorry the delay. The files were updated and now it will be a mess to show you something that can be readable and understandable for me and everybody. What I can say is that being careful in the markdown is the key. Thanks