How to add data section to Netlify CMS?

209 Views Asked by At

I have a Hugo-based site and a couple of partials on the main page that I would like to add as parts of CMS. The partials are made of HTML layout and YAML in the data section. How can I expose this information to CMS?

1

There are 1 best solutions below

0
qbeauperin On

Your question is a little vague, but assuming that your partials are driven by that YAML data, you can look at the file collection type to manage it.

Here's an example of what your config.yml file might look like:

collections:
  - label: "Settings"
    name: "settings"
    files:
      - label: "Partials"
        name: "partials"
        file: "data/partials.yml"
        fields:
          - label: "List of partials"
            name: "partials_list"
            widget: "list"
            fields:
              - {label: "Name", name: "name", widget: "string"}
              - {label: "Partial type", name: "type", widget: "select", options: ["typeA", "typeB", "typeC"] }