decap-cms: Files not showing in collection with 404 error
Since a few days, whenever I log in to the admin interface, only one file is loaded in a collection and an error message shows up after a few seconds :
Failed to persist entry: API_ERROR: {"message":"404 File Not Found"}
I have tried many changes in the config.yml file but did not find a solution. Here is my config.yml
:
backend:
name: git-gateway
branch: netlify # Branch to update (optional; defaults to master)
media_folder: "assets/images" # Media files will be stored in the repo under images/uploads
collections:
- name: "home-page" # Used in routes, e.g., /admin/collections/blog
label: "Page d'accueil" # Used in the UI
folder: "" # The path to the folder where the documents are stored
filter: {field: 'layout', value: 'home'}
create: false # 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: "home"}
- {label: "Show", name: "show_tile", widget: "hidden", default: "false"}
- {label: "Titre", name: "title", widget: "string"}
- {label: "Sous-titre", name: "landing-title", widget: "string"}
- {label: "Description", name: "description", widget: "string"}
- {label: "Actualités", name: "news", widget: "string"}
- {label: "Image principale", name: "image", widget: "image"}
- {label: "Body", name: "body", widget: "markdown"}
- name: "portfolio-pages" # Used in routes, e.g., /admin/collections/blog
label: "Pages des créations" # Used in the UI
folder: "" # The path to the folder where the documents are stored
filter: {field: 'layout', value: 'portfolio'}
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: "portfolio"}
- {label: "Show", name: "show_tile", widget: "hidden", default: "true"}
- {label: "Titre", name: "title", widget: "string"}
- {label: "Sous-titre", name: "subtitle", widget: "string"}
- {label: "Description", name: "description", widget: "string"}
- {label: "Image principale", name: "image", widget: "image"}
- {label: "Image 1", name: "image1", widget: "image", required: false}
- {label: "Image 2", name: "image2", widget: "image", required: false}
Everything worked fine until a few days ago. Did anybody experienced a similar bug ?
Thanks !
About this issue
- Original URL
- State: closed
- Created 6 years ago
- Comments: 19 (5 by maintainers)
The root is where you store your
admin
folder. It’s common practice for almost all static site gens to have folders for your data and posts though, but it’s good to know root doesn’t work 👍A folder collection should be a dedicated folder that only contains files that Netlify CMS will edit, the CMS is choking because it’s trying to load all of the various markdown files in your repo root. Instead use a file collection and provide the direct path to your home page. If your products pages such as
divers
andsacs
should be treated as a folder collection, put them inside of a dedicated directory and update thefolder
in the config accordingly.