Skip to content

File collection at same hierarchy level as folder type collection #1284

@snirp

Description

@snirp

Currently there you need an extra hierarchy level of files: to create a file type collection. I fail to see the need for this, as the CMS should be able to infer the correct collection type from the presence of either a folder or a file field.

To the end-user both are similar ways to add and edit data, but one is always hidden one hierarchy level deeper.

I would propose to no longer require the files hierarchy and nest the file collections directly under the collections field. Just like the folder collections.

Additionally: I can see use cases where the hierarchy would be beneficial to have. You could approach this more flexibly with custom "groupings". It would naively look something like this:

[...]
collections:
    - name: blog
      label: Blog
      folder: collections/blog
      create: true
      fields:
        - { name: "title", label: "Blog posting title" }
        - { name: "published", label: "Published", widget: "boolean", default: true}
        - { name: "date", label: "Date", widget: date }
        - { name: "author", label: "Author"}
        - { name: "body", label: "Resume", widget: "markdown" }
  - name: author
    label: Author
    file: collections/author.yaml
    fields:
      # somehow make this a list
      - { name: "id", label: "ID" }
      - { name: "bio", label: "Biography" }
  - group: "News items"
    - name: news
      label: Articles
      folder: collections/news
      create: true
      fields:
        - { name: "title", 
#etc

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions