Config.yml, how do I get mutliptle collections?

So, I built another 11ty site but I need multiple collections to work and I’m unfamiliar with that process. Here’s my current attempt with my current config.yml

backend:
  name: git-gateway
  branch: main

media_folder: "public/assets/guides-img"
public_folder: "/assets/guides-img"
collections: 
  - name: "guide"
    label: "guides"
    folder: "src/guide"
    create: true
    slug: "{{year}}-{{month}}-{{slug}}"
    fields: 
      - { label: "Title", name: "title", widget: "string" } 
      - { label: "Description", name: "description", widget: "string" }
      - { label: "Date", name: "date", widget: "datetime" }
      - { label: "Tags", name: "tags", widget: "list", default: ["guides"] }
      - { label: "Featured Image", name: "image", widget: "image" }
      - { label: "Image Caption", name: "imageAlt", widget: "string" }
      - { label: "Body", name: "body", widget: "markdown" }
   - name: "pages"
    label: "page"
    folder: "src/pages"
    create: true
    slug: "{{slug}}"
    fields: 
      - { label: "Title", name: "title", widget: "string" } 
      - { label: "Body", name: "body", widget: "markdown" }

Now here’s the error it gives me

Config Errors:
YAMLSyntaxError: All collection items must start at the same column at line 1, column 1:

backend:
^^^^^^^^…
Check your config.yml file.

I know for sure the error only occurs when I add in the second collection (i tested it)

So can someone please help me figure this out?

Thanks

I can see that this one seems to be in a different column than the above one. I believe, label should start exactly below name.

1 Like

ok thanks, so I need to indent it to be at the same line right?

That’s what the error says, yes.

1 Like

Ok it worked, thank you so much. Netlify is one of the best hosts I have ever seen. Keep up the good work!

I have exactly the same problem. It’s really useful because it’s hard to edit after working with JS. I searched on GitHub and found the answer here.

1 Like

I completely understand… Everyone, has strengths and weaknesses, coding JS is currently not one of them. I used to be a huge fan of YAML over JSON, but after using TOML almost daily, it is rough to get back on that horse and ride.

1 Like