我正在运行一个Gridsome项目,其中集成了Netlify-CMS。这是我的config.yml文件的样子:
backend:
name: github
branch: master # Branch to update (optional; defaults to master)
repo: user/repo
media_folder: "images/uploads"
public_folder: "/images/uploads"
collections:
- name: "blog" # Used in routes, e.g., /admin/collections/blog
label: "Blog" # Used in the UI
folder: "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: "Body", name: "body", widget: "markdown"}
- name: "projects" # Used in routes, e.g., /admin/collections/blog
label: "Projects" # Used in the UI
folder: "projects" # 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: "Customer", name: "customer", widget: "string"}
- {label: "Activity", name: "activity", widget: "string"}
- {label: "Date", name: "date", widget: "datetime"}
- {label: "Link", name: "link", widget: "string"}
- {label: "Featured Image", name: "thumbnail", widget: "image"}
- {label: "Body", name: "body", widget: "markdown"}
我可以在管理界面中同时看到Blog和Projects,但是,当我单击Project集合时,它不会在指定的文件夹中显示我现有的.md文件。同时,当我尝试创建一个新项目时,不会添加此项目,也不会显示错误消息。
Blog集合的所有功能都像魅力。
这是项目目录的样子:
答案 0 :(得分:0)
没有可以用作标识符的字段。现在,您必须具有一个名为“ title”的字段,或者将"identifier_field"设置为您要使用的字段的名称。该字段的值应该对于条目来说是唯一的,因此我想在每个项目中都添加一个“标题”可能是个好方法。
如果您可以为此在GitHub中打开一个错误以便我们进行调查,则应该有一个错误。