Problems with my collection (config.yml)

Hi, I’m having a hard time trying to write my config.yml to use it in netlify cms… everything is working great, but I’m having problems with the object field. It’s the first time that I use YAML so maybe I’m not seeing the obvious, but I appreciate the help.

I know this is something very specific, I already ask for help in the netlify forum, but if someone can help me with the YAML cause maybe I have a syntax problem or something that someone knows, I’d really appreciate it.

backend:
  name: git-gateway
  branch: gh-pages

media_folder: assets/img
public_folder: /img

collections:
  - name: 'projects'
    label: 'Projects'
    folder: 'content/projects'
    format: 'frontmatter'
    create: true
    slug: '{{year}}-{{month}}-{{day}}-{{slug}}'
    editor:
      preview: false
    fields:
      - { label: 'Title', name: 'title', widget: 'string' }
      - {
          label: 'Short Descripcion',
          name: 'short_description',
          widget: 'string',
        }
      - {
          label: 'Long Description',
          name: 'long_description',
          widget: 'string',
        }
      - {
          label: 'Tags',
          name: 'tags',
          widget: 'select',
          multiple: true,
          min: 1,
          max: 3,
          options: ['Social Media Design', 'Web Design', 'Art Direction'],
        }
      - {
          label: 'Thumbnail',
          name: 'thumbnail',
          widget: 'image',
          allow_multiple: false,
        }
      - {
          label: 'Project Images',
          name: 'images',
          widget: 'object',
          fields:
            - {label: 'RRSS Images', name: 'rrss', widget: 'image', allow_multiple: true, }
            - {label: 'WEB Images', name: 'web', widget: 'image', allow_multiple: true, }
        }

The problem happen in this part in the fields… property?

  - {
          label: 'Project Images',
          name: 'images',
          widget: 'object',
          fields:
            - {label: 'RRSS Images', name: 'rrss', widget: 'image', allow_multiple: true, }
            - {label: 'WEB Images', name: 'web', widget: 'image', allow_multiple: true, }
        }

BTW this the error that shows me…

Error loading the CMS configuration
Config Errors:
YAMLSemanticError: Separator , missing in flow map at line 49, column 15:

            - {label: 'RRSS Images', name: 'rrss', widget: 'image', allow_multi…
              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^…
Check your config.yml file.

Have you searched for a YAML checker on-line and pasted your code into it?

I pasted your code into one that I found and was able to clean it up.

Hi, thanks for answer.

In the netlify forum answer me, this was the final code, and it works great. For some reason the “project images” field (or well, that object) should not being an object like the other fields. Why? I don’t know

backend:
  name: git-gateway
  branch: gh-pages

media_folder: assets/img
public_folder: /img

collections:
  - name: 'projects'
    label: 'Projects'
    folder: 'content/projects'
    format: 'frontmatter'
    create: true
    slug: '{{year}}-{{month}}-{{day}}-{{slug}}'
    editor:
      preview: false
    fields:
      - { label: 'Title', name: 'title', widget: 'string' }
      - {
          label: 'Short Descripcion',
          name: 'short_description',
          widget: 'string',
        }
      - {
          label: 'Long Description',
          name: 'long_description',
          widget: 'string',
        }
      - {
          label: 'Tags',
          name: 'tags',
          widget: 'select',
          multiple: true,
          min: 1,
          max: 3,
          options: ['Social Media Design', 'Web Design', 'Art Direction'],
        }
      - {
          label: 'Thumbnail',
          name: 'thumbnail',
          widget: 'image',
          allow_multiple: false,
        }
      - label: 'Project Images'
        name: 'images'
        widget: 'object'
        fields:
          - {
              label: 'RRSS Images',
              name: 'rrss',
              widget: 'image',
              allow_multiple: true,
            }
          - {
              label: 'WEB Images',
              name: 'web',
              widget: 'image',
              allow_multiple: true,
            }

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.