Netlify-cms: Add 'Singles' type alongside 'Collections'

Created on 17 Aug 2017  路  10Comments  路  Source: netlify/netlify-cms

Original idea as outlined by @erquhart

Idea:

Allow for a 'Singles' content type, designed for one-off, often publicly-published pages such as 'About', 'Contact', etc. Anything that would not be appropriate as a repeatable object template in the way that 'folder' type Collections work in the CMS today.

This allows for the distinction in the 'Content' interface of these different content types. Collections allow for (+) buttons, Singles do not, as they are one-off. This is largely represented in the 'file' Collection type available in the CMS today.

screen shot 2017-08-16 at 5 19 00 pm

configuration ucollection discussion feature pinned

Most helpful comment

For a user to create a "Single" in the config, how would we want that to look? Should it look just like a regular file-type collection, except without having to be nested under a top-level files collection group?

Example:

collections:
    - label: "Homepage"
      name: "home"
      file: "site/content/_index.md"
      fields:
        - {label: Title, name: title, widget: string}
        - {label: Intro, name: intro, widget: markdown}
        ...

All 10 comments

@erquhart Please let me know if I've made anything unclear or vague here

This looks good on the UX side. I would only add that the CMS would need to support singles before this could move forward. It may be as simple as giving different treatment to file type collections with only one entry.

We've sort of discussed this elsewhere, but because the distinction between "collections" and "singles" is more of an implementation detail, I don't think having this automatic sorting in the UI is going to be helpful to editors.

It would be a bigger lift, but I think a more useful way of handling this would be to give implementers a way to group the labels in the sidebar. That way the UI can be made to fit the content it represents. It could be cool to have labels for each group, but even being able to add a separator somewhere in the list would be an improvement.

@verythorough that's an excellent point, and it has strong precedent in major SAAS CMS solutions like Contentful. Either way, we need to handle singles (clicking the link in the sidebar opens an entry directly), but the "editable sidebar" you're describing would be a great add post-1.0.

We should port this to a separate issue for proper tracking.

For a user to create a "Single" in the config, how would we want that to look? Should it look just like a regular file-type collection, except without having to be nested under a top-level files collection group?

Example:

collections:
    - label: "Homepage"
      name: "home"
      file: "site/content/_index.md"
      fields:
        - {label: Title, name: title, widget: string}
        - {label: Intro, name: intro, widget: markdown}
        ...

I really think that's the most straightforward way to handle it.

@tech4him1 I arrived at a similar idea in a duplicate. The terms are slightly different, but same idea:

...
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", 
        ...

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

Please, be a good bot and don't close this. @erquhart promised us changes soon. Let him close it when it's time 馃檪

Marking as pinned so it won't get flagged again

Was this page helpful?
0 / 5 - 0 ratings