如何在Netlify CMS中添加图像上传功能

时间:2019-03-16 03:14:53

标签: netlify-cms

嗨,我是Netlify CMS的新手,我刚刚从博客中学到了

所以我有config.yml在Netlify CMS中创建两个输入字段 enter image description here 样本:

collections:
  - name: 'team'
    label: 'Team'
    folder: 'src/team'
    create: true
    slug: '{{slug}}'
    fields:
      - { label: 'Team Member', name: 'title', widget: 'string' }
      - { label: 'Bio', name: 'bio', widget: 'markdown' }

我只是想知道如何为图像添加输入字段

谢谢!

1 个答案:

答案 0 :(得分:0)

只需添加

{ label: "Image", name: "thumbnail", widget: "image"}

进入您的一个字段

collections:
  - name: 'team'
    label: 'Team'
    folder: 'src/team'
    create: true
    slug: '{{slug}}'
    fields:
      - { label: 'Team Member', name: 'title', widget: 'string' }
      - { label: 'Bio', name: 'bio', widget: 'markdown' }
      - { label: "Image", name: "thumbnail", widget: "image"}

来源:https://www.netlifycms.org/docs/add-to-your-site/