Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Delete path folder when delete entry #3615

Open
Chathula opened this issue Apr 16, 2020 · 4 comments
Open

Delete path folder when delete entry #3615

Chathula opened this issue Apr 16, 2020 · 4 comments

Comments

@Chathula
Copy link

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.

@erezrokah erezrokah added the type: bug code to address defects in shipped code label Apr 19, 2020
@erezrokah
Copy link
Contributor

Thanks @Chathula for opening this.

@Chathula
Copy link
Author

@erezrokah we discussed this in the Netlify community as well.

what about giving an option to the user to set it. as an example, we can set deletePath option to true. when the user has set delete to true(by default it is true), we can delete that whole path.

https://community.netlify.com/t/delete-path-folder-when-delete-entry/12574/5

@devarellin
Copy link

Hi, any updates on this issue?

@martinjagodic martinjagodic added pinned and removed type: bug code to address defects in shipped code labels Aug 5, 2024
@christoph-freimuth
Copy link

Is there something new about this issue?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants