如何在netlifyCMS中使用动态文件夹添加集合

时间:2019-11-21 21:29:54

标签: netlify-cms

我正在使用NetlifyCMS,我想创建相同的集合(作者),但是每个条目都位于不同的文件夹中。 例如我希望在/content/author/john/_index.md

中创建条目John

这是我的作者收藏:

collections:
  - name: "author"
    label: "Author"
    folder: "content/author/XXXXXXXXXXXXXXXXXX" 
    create: true
    slug: "_index.md"
    fields: 
      - {label: "Url Path (no space)", name: "title", widget: "string"}
      - {label: "Full Name", name: "name", widget: "string"}
      - {label: "Email", name: "email", widget: "string"}
      - {label: "Github", name: "github", widget: "string", required: false}
      - {label: "Photo", name: "photo", widget: "image", required: false}
      - {label: "Description", name: "body", widget: "markdown"}

我尝试使用:

  • folder: "content/author/{{slug}}"slug: "/_index"content/author/{{slug}}/_index.md中创建了文件
  • folder: "content/author"slug: "{{slug}}/_index"content/author/john-_index.md中创建了文件

但是这些都不起作用。

0 个答案:

没有答案