Home
Support Forums

Problems with my collection (config.yml)

Hi, I’m having a hard time trying to write my config.yml to use it in the 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.

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.

I am no YAML expert but comparing it to the demo configuration file maybe try removing the brackets around ‘Project Images’.

The below at least validates for me, hopefully it still does what it is supposed to do in your repo.

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, }

1 Like

Brooo It worked, thanks a lot.

gif

1 Like

this is the final result.