我试图用NetlifyCMS连接Jekyll安装。我使用的自定义主题在没有CMS部分的情况下仍然可以正常运行,但是当我按照NetflifyCMS docs I进行集成时,会出现此错误。
~/.rvm/gems/ruby-2.5.1/gems/jekyll-3.4.1/lib/jekyll/collection.rb:158:in `sanitize_label': undefined method `gsub' for #<Hash:0x00007fed774d2a3
我正在Mac OSX上运行它,这是我的config.yml。相关部分是收集部分:
collections:
- name: 'docs'
output: true
label: 'Docs'
folder: '_docs/'
create: true
slug: '{{year}}-{{month}}-{{day}}-{{slug}}'
editor:
preview: false
fields:
- { label: 'Layout', name: 'layout', widget: 'hidden', default: 'post' }
- { label: 'Title', name: 'title', widget: 'string' }
- { label: 'Publish Date', name: 'date', widget: 'datetime' }
- { label: 'Body', name: 'body', widget: 'markdown' }
- name: 'faqs'
output: false
label: 'Faqs'
folder: '_faqs/'
create: true
slug: '{{year}}-{{month}}-{{day}}-{{slug}}'
editor:
preview: false
fields:
- { label: 'Layout', name: 'layout', widget: 'hidden', default: 'post' }
- { label: 'Title', name: 'title', widget: 'string' }
- { label: 'Publish Date', name: 'date', widget: 'datetime' }
- { label: 'Body', name: 'body', widget: 'markdown' }
- name: 'changelogs'
output: false
- name: 'blog'
output: true
label: 'Blog'
folder: '_posts/'
create: true
slug: '{{year}}-{{month}}-{{day}}-{{slug}}'
editor:
preview: false
fields:
- { label: 'Layout', name: 'layout', widget: 'hidden', default: 'post' }
- { label: 'Title', name: 'title', widget: 'string' }
- { label: 'Publish Date', name: 'date', widget: 'datetime' }
- { label: 'Body', name: 'body', widget: 'markdown' }
答案 0 :(得分:0)
发现了问题。 NetlifyCMS文档不清楚。这些集合应该已经放在./admin/config.yml
中,而我正在将它们放入主config.yml
文件中。