Not showing collections

When making changes on our dev branch, the CMS doesn’t reflect what’s on our master/production branch - we get an error (below). The expectation would be that the config.yml would create the new collection, groups, and fields in the CMS. However, we’re not seeing those changes on our auto-generated-dev-branch.netlify.com/admin

failed to load file from github: data/pages/resources.yml

I can log into the via /admin and see the blog, but my new resources collection isn’t visible.

here’s the new piece to the config.yml file

      -
    label: Resources
    name: resourcePage
    file: data/pages/resources.yml
    fields:
      -
        label: Documents
        name: documents
        widget: list
        fields:
          - {label: Title, name: title, widget: string}
          - {label: Image, name: photo, widget: image}
          - {label: URL, name: url, widget: string}
          - {label: Category, name: category, widget: select, multiple: false, options: [doctype1, doctype2, doctype3, etc.]}

Hey, and welcome :slight_smile:

One thing that’s likely causing a problem is the lack of quotation marks in your fields. I believe every value that’s not a boolean will need quotation marks around it, so where you have:
{label: Title, name: title, widget: string}
you need instead:
{label: "Title", name: "title", widget: "string"}

Same for that last field, except multiple: false, is fine as-is since the value is a boolean.

Do you want to give that a shot and see if the CMS picks it up?

To get data for a specific branch, you have to set the branch in your backend settings:

backend: 
  name: git-gateway
  branch: 'dev-branch-name'

Unfortunately Netlify CMS isn’t able to switch branches by default yet, but there are a couple of workarounds using manual init: Request: Support for Scoping by Branch · Issue #1737 · netlify/netlify-cms · GitHub

@jen actually yaml handles strings without explicit quotation marks pretty well, unless the string contains special character etc.

Thank you @jen and @tomrutgers for you quick replies.

I guess I’ll have to fiddle with it then. @jen, we have not had any problems with the .yml until this new collection was committed. When we push to the dev branch, all the functionality and collections that exist on master show up except for the new collection. It seems there are some things not making sense with the backend setup as you mentioned @tomrutgers I would tend to agree with your assessment except that we were fully functional on the dev side too prior to adding the new collection.

If there are any other ideas, I’m happy to try. However, it’s good to know that NetlifyCMS doesn’t support switching branches. Do you suggest live testing?

Can you share a live url or repo so I can have a look? Also the full contents of your config.yml can help.

1 Like

Here’s what the config looks like:

backend:
name: github
repo: organization/repo

media_folder: static/uploads
public_folder: /uploads
publish_mode: editorial_workflow

collections:
 -
  label: Blog Posts
  name: blog
  folder: data/blog
  create: true
  slug: "{{slug}}"
  fields:
  - {label: Title, name: title, widget: string}
  - {label: Description, name: description, widget: string}
  - {label: Publish Date, name: date, widget: date}
  - {label: Cover Image, name: coverImage, widget: image}
  - {label: Categories, name: categories, widget: select, multiple: true, options: [doctype1, doctype2, doctype3]}
  - {label: Body, name: body, widget: markdown}
-
label: Pages
name: pages
files:
  -
    label: Team Page
    name: team
    file: data/pages/team.yml
    fields:
      -
        label: Members
        name: members
        widget: list
        fields:
          - {label: Name, name: name, widget: string}
          - {label: Position, name: position, widget: string}
          - {label: Photo, name: photo, widget: image}
          - {label: Body, name: body, widget: markdown}
  -
    label: Events
    name: events
    file: data/pages/events.yml
    fields:
      -
        label: Hero
        name: Hero
        widget: object
        fields:
          - {label: Title, name: title, widget: string}
      -
        label: Upcoming Section
        name: upcomingSection
        widget: object
        fields:
          - {label: Title, name: title, widget: string}
      -
        label: Past Section
        name: pastSection
        widget: object
        fields:
          - {label: Title, name: title, widget: string}
      -
        label: Events
        name: events
        widget: list
        fields:
          - {label: Title, name: title, widget: string}
          - {label: Date, name: date, widget: date}
          - {label: End Date, name: endDate, widget: date}
          - {label: Location, name: location, widget: string}
          - {label: Image, name: image, widget: image}
          - {label: URL, name: url, widget: string}
          - {label: Description, name: description, widget: string}
  -
    label: Solutions
    name: solutions
    file: data/pages/solutions.yml
    fields:
      -
        label: Resource Section
        name: resourceSection
        widget: object
        fields:
          - {label: Title, name: title, widget: string}
          - {label: Description, name: description, widget: string}
          - {label: CTA, name: cta, widget: string}
          - {label: URL, name: url, widget: string}
          - {label: Photo, name: photo, widget: image}
          - {label: Body, name: Body, widget: markdown}
      -
        label: Customers
        name: customers
        widget: list
        fields:
          - {label: Name, name: name, widget: string}
          - {label: Wistia ID, name: wistiaId, widget: string}
          - {label: Body, name: body, widget: markdown}
  -
    label: Partners
    name: partnerPage
    file: data/pages/partners.yml
    fields:
      -
        label: Partners
        name: partners
        widget: list
        fields:
          - {label: Name, name: name, widget: string}
          - {label: Image, name: photo, widget: image}
          - {label: URL, name: url, widget: string}
          - {label: Body, name: body, widget: markdown}
  -
    label: News
    name: news
    file: data/pages/news.yml
    fields:
      -
        label: Articles
        name: articles
        widget: list
        fields:
          - {label: URL, name: url, widget: string}
          - {label: Image, name: photo, widget: image}
          - {label: Date, name: date, widget: date}
          - {label: Body, name: body, widget: markdown}
          - {label: Description, name: description, widget: string}
  -
    label: Resources
    name: resourcePage
    file: data/pages/resources.yml
    fields:
      -
        label: Documents
        name: documents
        widget: list
        fields:
          - {label: Title, name: title, widget: string}
          - {label: Image, name: photo, widget: image}
          - {label: URL, name: url, widget: string}
          - {label: Category, name: category, widget: select, multiple: false, options: [documenttype1, documenttype2, documenttype3]}

I’m not able to reproduce this - even if the file is missing, the CMS will show the collection and load a blank entry. Can you go to the staging url and access config.yml directly to determine if the collection is actually configured for that deployment?

Sorry for jumping in late here, but having the following information will help tracking down the problem:

  1. CMS version as displayed in the browser console log.
  2. Browser network traffic when trying to load the Pages collections (will help make sure the CMS is connecting to the correct repo and branch).
  3. As @erquhart mentioned, the config.yml browser network response when loading the CMS (will help make sure that the deployed config matches our expectations).
  4. Testing it will local_backend: true (Beta Features! | Netlify CMS | Open-Source Content Management System). If using a local backend works, this is probably a branch configuration issue or a that the deployed config.yml is out of date.