Search code examples
netlify-cms

How to add image upload functionality in Netlify CMS


Hi I'm new to Netlify CMS I just learned about it from a blog

so I have config.yml that creates two input fields in Netlify CMS enter image description here Sample:

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' }

I'm just wondering how can I add input field for the image

Thanks!


Solution

  • Just add

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

    into one of your fields

    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"}
    

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