# See https://github.com/netlify/netlify-cms/blob/master/example/config.yml
backend:
  name: git-gateway
  branch: 0.3.0 # Branch to update (optional; defaults to master)

# display_url: https://netlify-cms-react-starter.netlify.com # This url will display in the top-right of the CMS
media_folder: "public/images/uploads" # Media files will be stored in the repo under static/images/uploads
public_folder: "/images/uploads" # The src attribute for uploaded media will begin with /images/uploads

collections: # A list of collections the CMS should be able to edit
  - name: "pages"
    label: "Page"
    delete: false # Prevent users from deleting documents in this collection
    editor:
      preview: true
    files:
      - file: "content/pages/home.md"
        label: "Home Page"
        name: "home-page"
        fields:
          - {label: Title, name: title, widget: string}
          - {label: Subtitle, name: subtitle, widget: markdown}
          - {label: Body, name: body, widget: markdown}

      - file: "content/pages/about.md"
        label: "About Page"
        name: "about-page"
        fields:
          - {label: Title, name: title, widget: string}
          - {label: Subtitle, name: subtitle, widget: markdown}
          - {label: Featured Image, name: featuredImage, widget: image}
          - {label: Section 1, name: section1, widget: markdown}
          - {label: Section 2, name: section2, widget: markdown}

      - file: "content/pages/contact.md"
        label: "Contact Page"
        name: "contact-page"
        fields:
          - {label: Title, name: title, widget: string}
          - {label: Subtitle, name: subtitle, widget: markdown}
          - {label: Featured Image, name: featuredImage, widget: image}
          - {label: Body, name: body, widget: markdown}
          - {label: Address, name: address, widget: text}
          - {label: Phone, name: phone, widget: string}
          - {label: Email Address, name: email, widget: string}

      - file: "content/pages/blog.md"
        label: "Blog Page"
        name: "blog-page"
        fields:
          - {label: Title, name: title, widget: string}
          - {label: Subtitle, name: subtitle, widget: markdown}
          - {label: Featured Image, name: featuredImage, widget: image}


  - name: posts
    label: Post
    editor:
      preview: true
    folder: content/posts
    slug: "{{year}}-{{month}}-{{day}}-{{slug}}"
    create: true # Allow users to create new documents in this collection
    fields: # The fields each document in this collection have
      - {label: Title, name: title, widget: string}
      - label: 'Status'
        name: 'status'
        widget: 'select'
        options: ["Published", "Featured", "Draft"]
        default: 'Published'
      - {label: Date / Order, name: date, widget: date}
      - {label: Post Featured Image, name: postFeaturedImage, widget: image, required: false}
      - {label: Excerpt, name: excerpt, widget: text}
      - {label: Content, name: body, widget: markdown}
      - label: "Categories"
        name: "categories"
        widget: "list"
        required: false
        fields:
          - label: "Category"
            name: "category"
            widget: "relation"
            collection: "postCategories"
            searchFields: ["title"]
            valueField: "title"


  - name: postCategories
    label: Post Category
    editor:
      preview: false
    folder: content/postCategories
    slug: "{{slug}}"
    create: true # Allow users to create new documents in this collection
    fields: # The fields each document in this collection have
      - {label: Title, name: title, widget: string}


  - name: "settings"
    label: "Settings"
    delete: false # Prevent users from deleting documents in this collection
    editor:
      preview: false
    files:
      - file: "content/settings/global.yml"
        label: "Global Settings"
        name: "global-settings"
        fields:
          - {label: Site Title, name: siteTitle, widget: string}
          - {label: Site Url, name: siteUrl, widget: string, required: false}
          - {label: Site Description, name: siteDescription, widget: text, required: false}
          - label: Social Media Card
            name: socialMediaCard
            widget: object
            fields:
              - {label: Image, name: image, widget: image, required: false}
              - {label: Twitter Site Account, name: twitterSiteAccount, widget: string, required: false}
              - {label: Twitter Creator Account, name: twitterCreatorAccount, widget: string, required: false}
          - {label: Header Meta / Scripts, name: headerScripts, widget: text, required: false}
          - {label: Enable Service Worker Pre-Cache, name: enableServiceWorker, widget: boolean, required: false}
