Skip to content

Unable to access multiple objects from the same file collection #4518

@pmpinto

Description

@pmpinto

Describe the bug
I have a file with multiple objects, as such:

# my-collection.yml
first:
  # stuff nested here
second:
  # more stuff here
third:
  # more stuff here

I set this up as a file collection in the CMS, for instance:

# config.yml
collections:
  - name: 'my_collection'
    label: 'My collection'
    files:
      - label: 'First'
        name: 'first'
        file: 'my-collection.yml'
        fields:
          # many fields here
      - label: 'Second'
        name: 'second'
        file: 'my-collection.yml'
        fields:
          # many fields here

Then I go check the CMS under "My collection" and I have:

  • First
  • First

Seems to me that if I'm adding the same file under the same collection, it reuses the first occurrence of that file as many times as the number of entries under files.

To overcome this issue I'm creating multiple collections, each with 1 file, which seems inappropriate to me.

To Reproduce
Follow the set up described above 👆

Expected behavior
I would expect to have this list under "My collection":

  • First
  • Second

Applicable Versions:

  • Netlify CMS version: 2.10.66
  • Git provider: GitHub
  • OS: macOS Catalina (10.15.6)
  • Browser version: Brave 1.14.84
  • Node.JS version: 12.17.0

CMS configuration
See above 👆

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions