decap-cms icon indicating copy to clipboard operation
decap-cms copied to clipboard

Feature - Add a limit to folder collection sizes

Open ItsEthanH opened this issue 11 months ago • 2 comments

Is your feature request related to a problem? Please describe. Not that I'm aware of

Describe the solution you'd like I would like to be able to limit the number of entries a user can create within a collection. This could be configured in config.yml in a way similar to below:

collections:
  - name: "blog" # Used in routes, e.g., /admin/collections/blog
    label: "Blog" # Used in the UI
    limit: 25 # Only a maximum of 25 blog posts can be made in this collection
    folder: "_posts/blog" # The path to the folder where the documents are stored
    create: true # Allow users to create new documents in this collection
    slug: "{{year}}-{{month}}-{{day}}-{{slug}}" # Filename template, e.g., YYYY-MM-DD-title.md
    fields: # The fields for each document, usually in front matter
      - { label: "Layout", name: "layout", widget: "hidden", default: "blog" }
      - { label: "Title", name: "title", widget: "string" }
      - { label: "Publish Date", name: "date", widget: "datetime" }
      - { label: "Featured Image", name: "thumbnail", widget: "image" }
      - { label: "Rating (scale of 1-5)", name: "rating", widget: "number" }
      - { label: "Body", name: "body", widget: "markdown" }

When the user creates 25 posts, the Create New button would be disabled, perhaps with a warning text saying that they have hit their 25 page limit

Describe alternatives you've considered The only alternative I've thought of would be to use an event or some custom JS within the page where Decap is loaded and implement this manually. Or create a webhook that notifies me to go into the config.yml file to change create to false when the limit is hit. Both of these seem like very hack-y solutions to something I would've thought could be native functionality

Additional context

N/A

ItsEthanH avatar Feb 25 '25 14:02 ItsEthanH

Sounds like a useful feature!

BuckyBuck135 avatar Feb 25 '25 14:02 BuckyBuck135

Is anyone workingbon it currently ? I would like to work on that

RohitPeswani avatar May 10 '25 14:05 RohitPeswani