-
-
Notifications
You must be signed in to change notification settings - Fork 3.1k
Description
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