Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

YAMLSyntaxError: All collection items must start at the same column at line X column X

Im getting this error when trying to run netlify CMS.

Error loading the CMS configuration
Config Errors:
YAMLSyntaxError: All collection items must start at the same column at line 71, column 5:

  - name: 'data'
    ^^^^^^^^^^^^…
Check your config.yml file.

This is my config.yml file. Everythin else works fine but when trying to access the admin im thrown that error. I checked the identation and everything seems fine to me. Checked line 51 but couldnt findwhat the syntax error is.

    ---
    ---
    
    collections:
    
      - name: 'blog'
        label: 'Posts'
        folder: '_posts'
        create: true
        slug: '{{"{{year"}}}}-{{"{{month"}}}}-{{"{{day"}}}}-{{"{{slug"}}}}'
        fields:
          - { label: 'Layout', name: 'layout', widget: 'hidden', default: 'post' }
          - { label: 'Title', name: 'title', widget: 'string' }
          - { label: 'Date', name: 'date', widget: 'date', format: 'YYYY-MM-DD' }
          - { label: 'Description', name: 'description', widget: 'string' }
          - { label: 'Author', name: 'author', widget: 'string' }
          - { label: 'Excerpt', name: 'excerpt', widget: 'string' }
          - { label: 'Image', name: 'image', widget: 'image' }
          - { label: 'Thumbnail', name: 'thumbnail', widget: 'image' }
          - {
              label: 'Image credit',
              name: 'imageCredit',
              widget: 'string',
              required: false,
            }
          - { label: 'Type', name: 'type', widget: 'hidden', default: 'article' }
          - { label: 'Keywords', name: 'keywords', widget: 'string' }
          - { label: 'Tags', name: 'tags', widget: 'string' }
          - { label: 'Hidden', name: 'hidden', widget: 'boolean', default: false }
          - { label: 'Body', name: 'body', widget: 'markdown' }
    
      - name: 'job_openings'
        label: 'Job Openings'
        folder: '_job_openings'
        create: true
        slug: '{{"{{year"}}}}-{{"{{month"}}}}-{{"{{day"}}}}-{{"{{slug"}}}}'
        fields:
          - { label: 'Layout', name: 'layout', widget: 'hidden', default: 'job-opening' }
          - { label: 'Title', name: 'title', widget: 'string' }
          - { label: 'Location', name: 'location', widget: 'string', default: 'Remote' }
          - {
              label: 'Time',
              name: 'time',
              widget: 'select',
              options: ['Full Time', 'Half-Time / Hourly'],
            }
          - { label: 'Description', name: 'description', widget: 'text' }
          - { label: 'Salary range', name: 'salaryRange', widget: 'string', required: false }
          - label: 'Responsibilities'
            name: 'responsibilities'
            widget: 'list'
            field: {label: 'Responsibility', name: 'responsibility', widget: 'string'}
          - label: 'Requirements'
            name: 'requirements'
            widget: 'list'
            field: {label: 'Requirement', name: 'requirement', widget: 'string'}
          - { label: 'Hidden', name: 'hidden', widget: 'boolean', default: false }
      
    
      - name: 'data'
        label: 'Data'
        editor:
          preview: false
        files:
          - name: 'departments'
            label: 'Departments'
            file: '_data/departments.json'
            fields:
              - name: 'data'
                label: 'Departments'
                widget: 'list'
                fields:
                  - { label: 'Name', name: 'name', widget: 'string' }
                  - {
                      label: 'Avatar',
                      name: 'avatar',
                      widget: 'image',
                      required: false,
                    }
          
          -name: 'career-pathways'          
            label: 'Pathways'
            file: '_data/career-pathways.json'
            fields:
              -name: 'data'
                label: 'Guilds'
                widget: 'list'
                fields:
                  - { label: 'Name', name: 'name', widget: 'string' }
                  -name: 'levels'
                    label: 'Levels'
                    widget: 'list'
                    fields:
                      - { label: 'Title', name: 'title', widget: 'string' }
                      - { label: 'Type', name: 'type', widget: 'string' }

Again, everything works fine. I can access the collections as well. Don't really know what may be causing this.

like image 630
Fer Zelaya Avatar asked Oct 15 '22 22:10

Fer Zelaya


1 Answers

Like Ross mentioned in the comment, you have three times -name: instead of - name: in the YAML, so just add the space between - and the key name.

There are no line numbers. But the three from the bottom.

like image 163
KargWare Avatar answered Oct 19 '22 00:10

KargWare