decaporg / decaporg/decap-cms

Delete path folder when delete entry

Open
#3,615 5 comments 4 reactions 0 assignees View on GitHub
pinned status: confirmed
Dominant language
JavaScript
Stars
19.4k
Forks
3.1k
Avg merge
1d 14h
Merged PRs (30d)
9

Description

I have integrated Netlify CMS with Gatsby. it works well when creating a new entries. but when delete. it only deletes the `index.md` file. I need to delete the whole `path` folder. how can I do it?

Here are my content paths and config file.

content path: `content/year-month-day-path/`

backend:
name: github
repo: test/repo

local_backend:
url: http://localhost:8081/api/v1

media_folder: "static/assets"
public_folder: assets

collections:
- name: "post" # Used in routes, e.g., /admin/collections/blog
label: "Post" # Used in the UI
folder: "content" # The path to the folder where the documents are stored
create: true # Allow users to create new documents in this collection
path: "{{year}}-{{month}}-{{day}}-{{path}}/{{slug}}"
slug: "index" # 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", required: true}
- {label: "Publish Date", name: "date", widget: "datetime", required: true}
- {label: "Path", name: "path", widget: "string",required: true }
- {label: "Cover Image", name: "cover", widget: "image", required: true}
- {label: "Tags", name: tags, widget: list, required: false, default: [] }
- {label: "Excerpt", name: "excerpt", widget: "string", required: false}
- {label: "Body", name: "body", widget: "markdown", required: true}

When I create a new entry with image it creates two entries for `.md` file and for an image. but when I want to delete, it only removes that `index.md` fille. need to delete the whole folder.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.