Config.yml - Add metadata fields to markdown file

Hi,

I need to manage metadata information of my markdown file with this structure:

meta:
    - name: title
      content: Lorem ipsum
    - name: description
      content: Lorem ipsum 
    - name: keywords
      content: Lorem, ipsum
    - name: viewport
      content: width=device-width, initial-scale=1
    - name: robots
      content: noindex

I don’t know how to set in the config.yml file. I have revised the object widget for it but I haven’t clear how to set the ‘content’ field.

I have tried:

  • label: “Meta”
    name: “meta”
    widget: “object”
    collapsed: true
    fields:
    • {label: “title”, name: “title”, widget: “string”}
    • {label: “description”, name: “description”, widget: “string”}
    • {label: “robots”, name: “robots”, widget: “string”, default: “noindex”}

But in the markdown file saved as:

meta:
  title: Lorem ipsum
  description: Lorem ipsum
  robots: noindex

So the render doesn’t working fine to metadata with this syntax.

My question : Is possible to create a field in Netlify CMS as my first example?

meta:
- name: title
content: Lorem ipsum
- name: description
content: Lorem ipsum
- name: keywords
content: Lorem, ipsum
- name: viewport
content: width=device-width, initial-scale=1
- name: robots
content: noindex

I would appreciate your help.

Hey there, @dcodesys :wave:

Thanks for reaching out. Looks like you posted your question a little while ago, but that you haven’t received a solution yet. @tomrutgers may have some ideas here. If not, here’s where you might get more help:

netlifycms.org - the site houses our extensive documentation that likely contains helpful information to get you back on track.

netlify cms slack - join our friendly slack channel and chat with other cms pros to get the help you need.

GitHub Issues - think you’ve found a bug, or would like to make a feature request? Make your voice heard here. Netlify CMS is open source - PRs and other contributions are also welcome!

Stack Overflow Check StackOverflow for questions tagged “Netlify CMS” if you don’t get an answer in the Slack or the GH issues. StackOverflow reaches a worldwide audience of knowledgeable people.

Your question will be left open here for anyone to comment - but we encourage you to check out the above resources if you are still looking for a solution!

Your frontmatter is formatted as a yaml list, so you need the list widget:

- name: meta
  widget: list
  fields: 
    - {name: title}
    - {name: content}
2 Likes

Works! Thank you very much :wink:

2 Likes