1

Hi I am working from the gatsby-starter-netlify-cms and have setup a secondary blog called "Bios" I used the blog as a template and have it displaying from the .md file correctly, the problem is that when I try to update or add a new bio the content manager displays correctly however when I press publish it never actually publishes the changes (green line goes forever...)

Console shows: "Uncaught (in promise) Error: Collection must have a field name that is a valid entry identifier, or must have identifier_field set"

the repo is at https://github.com/theMakersOrg/theMakersWebsiteV2

here is the code in my config.yaml

backend:
  name: git-gateway
  branch: master

media_folder: static/img
public_folder: /img

collections:
  - name: 'blog'
    label: 'Blog'
    folder: 'src/pages/blog'
    create: true
    slug: '{{year}}-{{month}}-{{day}}-{{slug}}'
    fields:
      - {
          label: 'Template Key',
          name: 'templateKey',
          widget: 'hidden',
          default: 'blog-post',
        }
      - { label: 'Title', name: 'title', widget: 'string' }
      - { label: 'Publish Date', name: 'date', widget: 'datetime' }
      - { label: 'Description', name: 'description', widget: 'text' }
      - { label: 'Body', name: 'body', widget: 'markdown' }
      - { label: 'Tags', name: 'tags', widget: 'list' }

  - name: 'bios'
    label: 'Bio'
    folder: 'src/pages/bios'
    create: true
    slug: '{{year}}-{{month}}-{{day}}-{{slug}}'
    fields:
      - {
          label: 'Template Key',
          name: 'templateKey',
          widget: 'hidden',
          default: 'bio-post',
        }
      - { label: 'Name', name: 'name', widget: 'string' }
      - { label: 'Publish Date', name: 'publishDate', widget: 'datetime' }
      - { label: 'Description', name: 'description', widget: 'text' }
      - { label: 'image', name: 'image1', widget: 'image' }
      - { label: 'Body', name: 'body', widget: 'markdown' }
      - { label: 'Tags', name: 'tags', widget: 'list' }

  - name: 'pages'
    label: 'Pages'
    files:
      - file: 'src/pages/about/index.md'
        label: 'About'
        name: 'about'
        fields:
          - {
              label: 'Template Key',
              name: 'templateKey',
              widget: 'hidden',
              default: 'about-page',
            }
          - { label: 'Title', name: 'title', widget: 'string' }
          - { label: 'Body', name: 'body', widget: 'markdown' }
      - file: 'src/pages/products/index.md'
        label: 'Products Page'
        name: 'products'
        fields:
          - {
              label: 'Template Key',
              name: 'templateKey',
              widget: 'hidden',
              default: 'product-page',
            }
          - { label: Title, name: title, widget: string }
          - { label: Image, name: image, widget: image }
          - { label: Heading, name: heading, widget: string }
          - { label: Description, name: description, widget: string }
          - {
              label: Intro,
              name: intro,
              widget: object,
              fields:
                [
                  { label: Heading, name: heading, widget: string },
                  { label: Description, name: description, widget: text },
                  {
                    label: Blurbs,
                    name: blurbs,
                    widget: list,
                    fields:
                      [
                        { label: Image, name: image, widget: image },
                        { label: Text, name: text, widget: text },
                      ],
                  },
                ],
            }
          - {
              label: Main,
              name: main,
              widget: object,
              fields:
                [
                  { label: Heading, name: heading, widget: string },
                  { label: Description, name: description, widget: text },
                  {
                    label: Image1,
                    name: image1,
                    widget: object,
                    fields:
                      [
                        { label: Image, name: image, widget: image },
                        { label: Alt, name: alt, widget: string },
                      ],
                  },
                  {
                    label: Image2,
                    name: image2,
                    widget: object,
                    fields:
                      [
                        { label: Image, name: image, widget: image },
                        { label: Alt, name: alt, widget: string },
                      ],
                  },
                  {
                    label: Image3,
                    name: image3,
                    widget: object,
                    fields:
                      [
                        { label: Image, name: image, widget: image },
                        { label: Alt, name: alt, widget: string },
                      ],
                  },
                ],
            }
          - {
              label: Testimonials,
              name: testimonials,
              widget: list,
              fields:
                [
                  { label: Quote, name: quote, widget: string },
                  { label: Author, name: author, widget: string },
                ],
            }
          - { label: Full_image, name: full_image, widget: image }
          - {
              label: Pricing,
              name: pricing,
              widget: object,
              fields:
                [
                  { label: Heading, name: heading, widget: string },
                  { label: Description, name: description, widget: string },
                  {
                    label: Plans,
                    name: plans,
                    widget: list,
                    fields:
                      [
                        { label: Plan, name: plan, widget: string },
                        { label: Price, name: price, widget: string },
                        {
                          label: Description,
                          name: description,
                          widget: string,
                        },
                        { label: Items, name: items, widget: list },
                      ],
                  },
                ],
            }
3
  • Were there any errors in the console of the browser if you inspect the page? Commented Dec 11, 2018 at 23:00
  • There is one that looks suspicious. "Uncaught (in promise) Error: Collection must have a field name that is a valid entry identifier, or must have identifier_field set" Commented Dec 11, 2018 at 23:06
  • managed to fix it by adding the identifier_field Commented Dec 11, 2018 at 23:22

1 Answer 1

3

Note: Folder collections must have at least one field with the name title for creating new entry slugs. That field should use the default string widget. The label for the field can be any string value. If you wish to use a different field as your identifier, set identifier_field to the field name.

Needed to set the identifier_field based on docs

- name: 'bios'
label: 'Bio'
folder: 'src/pages/bios'
create: true
slug: '{{year}}-{{month}}-{{day}}-{{slug}}'
format: 'frontmatter'
identifier_field: makerName
fields:
  - {
      label: 'Template Key',
      name: 'templateKey',
      widget: 'hidden',
      default: 'bio-post',
    }
  - { label: 'Maker Name', name: 'makerName', widget: 'string' }
  - { label: 'Publish Date', name: 'publishDate', widget: 'datetime' }
  - { label: 'Description', name: 'description', widget: 'text' }
  - { label: 'image', name: 'image1', widget: 'image' }
  - { label: 'Body', name: 'body', widget: 'markdown' }
  - { label: 'Tags', name: 'tags', widget: 'list' }
Sign up to request clarification or add additional context in comments.

1 Comment

yep, that is the issue. It is in the docs for a collection

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.