Jekyll - Netlify CMS:site.collections 不返回自定义集合 netlify cms

问题描述

我刚刚开始学习 SSG,目前使用 jekyll + netlify CMS,我创建了一个名为 https://partner-stage.smiledirectclub.com/www.elly.com自定义集合。 在后台,我可以查看、创建和修改我的新集合和里面的文档,我正在尝试弄清楚如何在前端访问它们。我不明白如何列出它们。

config.yml

projects

后台截图

enter image description here

projects.html

backend:
  name: git-gateway # Netlify’s Git Gateway connects to Git provider’s API
  branch: master # Branch to update (master by default)

media_folder: "assets/img/uploads" # Folder where user uploaded files should go

publish_mode: editorial_workflow # Enable drafts

collections: # A list of collections the CMS should be able to edit
    # PAGES
  - name: "page"
    label: "Page"
    folder: "pages"
    sort: "title:asc"
    create: false
    slug: "{{slug}}"
    fields:
      - {label: "Layout",name: "layout",widget: "hidden",default: "page"}
      - {label: "Title",name: "title",widget: "string",tagname: "h1"}
      - {label: "Meta Description",name: "Meta_description",required: false}
      - {label: "Permalink",name: "permalink",widget: "hidden"}
      - {label: "Section",name: "section",default: "{{name}}"}
      - {label: "Intro Paragraph",name: "intro_paragraph",widget: "markdown",required: false}
      - {label: "Body",name: "body",required: false}
  # POSTS
  - name: "post" # Used in routes,ie.: /admin/collections/:slug/edit
    label: "Post" # Used in the UI,ie.: "New Post"
    folder: "_posts" # The path to the folder where the documents are stored
    sort: "date:desc" # Default is title:asc
    create: true # Allow users to create new documents in this collection
    slug: "{{year}}-{{month}}-{{day}}-{{slug}}"
    fields: # The fields each document in this collection have
      - {label: "Layout",default: "post"}
      - {label: "Title",required: false}
      - label: "Author"
        name: "author"
        widget: "select"
        options:
          - { label: "Dan UrbaNowicz",value: "dan_urbaNowicz" }
          - { label: "John Doe",value: "john_doe" }
      - {label: "Publish Date",name: "date",widget: "datetime",format: "YYYY-MM-DD HH:mm:ss"}
      - {label: "Intro Paragraph",required: false}
      - {label: "Categories",name: "categories",required: false}
  # PROJECTS
  - name: "projects"
    label: "Projects"
    folder: "_projects"
    create: true # Allow users to create new documents in this collection
    slug: "{{title}}"
    fields: # The fields for each document,usually in front matter
      - {label: "Layout",default: "project"}
      - { label: "Title",widget: "string" }
      - label: "gallery"
        name: "galleryImages"
        widget: "list"
        summary: '{{fields.image}}'
        field: {label: Image,name: image,widget: image}

项目页面截图

enter image description here

有谁知道我忘记了什么?

多谢指教!

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)