即使 github 请求 returns 项,Netlify-cms 现有集合项也不会显示

Netlify-cms existing collection items are not displayed even if github request returns item

我正在使用 netlify-cms 2.10.68、netlify-cms-app 2.11.20 和 Gatsby 2.26.1 来做一个简单的活动列表网站。

当我重新启动服务器或重新部署时,cms 中不显示现有的收集项。

检查 github 的网络流量以检索项目时 returns 它们没问题。

对于接下来要看的地方有点迷茫?

这里是:

来自 github 的网络响应由 netlify-cms

{
  "sha": "3.....",
  "url": "https://api.github.com/repos/organisation/repo/git/trees/3.......",
  "tree": [
    {
      "path": "test-webinar-1.md",
      "mode": "100644",
      "type": "blob",
      "sha": "a....",
      "size": 133,
      "url": "https://api.github.com/repos/organisation/repo/git/blobs/a...."
    }
  ],
  "truncated": false
}

我的./static/admin/config.yml

backend:
  name: github
  repo: repo_name
  branch: production
media_folder: static/images/uploads
public_folder: images/uploads

collections:
  - name: 'webinar'
    label: 'Webinar'
    folder: '/data/events/webinar'
    nested:
      depth: 100
    slug: '{{slug}}'
    create: true
    filter: { field: 'Type', value: 'Webinar' }
    path: '{{title}}'
    fields:
      - { name: 'title', label: 'Event Name' }
      - label: 'Event Type'
        name: 'event_type'
        widget: 'select'
        multiple: false
        description: 'Event Type (Conference, Webinar, Workshop etc.)'
        options: ['Conference', 'Webinar', 'Workshop']
      - { name: 'date', label: 'Date', widget: 'datetime' }
      - label: 'Event Status'
        name: 'status'
        widget: 'select'
        multiple: false
        description: 'Page status'
        options: ['Draft', 'Hidden', 'Testing', 'Public', 'Private']
      - { name: 'body', label: 'Body', widget: 'markdown' }

我的./package.json

{
  "name": "event-microsite",
  "description": "Did you want some events?",
  "license": "UNLICENSED",
  "private": true,
  "version": "0.1.0",
  "scripts": {
    "build": "gatsby build",
    "clean": "gatsby clean",
    "develop": "gatsby develop",
    "fd": "gatsby clean && gatsby develop",
    "fpd": "gatsby clean && gatsby build && gatsby deploy",
    "format": "prettier --write \"**/*.{js,jsx,ts,tsx,json,md}\" \"!{package.json, yarn.lock, .cache/*, public/*\"",
    "serve": "gatsby serve",
    "start": "npm run develop",
    "test": "echo \"Write tests! -> https://gatsby.dev/unit-testing\" && exit 1",
    "precommit": "yarn format"
  },
  "dependencies": {
    "@material-ui/core": "^4.11.0",
    "@types/js-cookie": "^2.2.6",
    "codemirror": "^5.58.2",
    "gatsby": "^2.26.1",
    "gatsby-image": "^2.6.0",
    "gatsby-plugin-hubspot": "^1.3.4",
    "gatsby-plugin-netlify-cms": "4.1.40",
    "gatsby-source-filesystem": "^2.5.0",
    "gatsby-source-hubspot-forms": "^2.2.0",
    "gatsby-transformer-remark": "^2.10.0",
    "immutable": "3.7.6",
    "isomorphic-unfetch": "^3.1.0",
    "js-cookie": "^2.2.1",
    "lodash": "^4.17.20",
    "moment": "^2.29.1",
    "netlify-cms": "^2.10.68",
    "netlify-cms-app": "2.11.20",
    "netlify-cms-lib-util": "^2.11.5",
    "netlify-cms-lib-widgets": "^1.6.0",
    "react": "^16.12.0",
    "react-dom": "^16.12.0",
    "react-router": "^5.2.0",
    "redux": "^3.0.5",
    "seamless-immutable": "^7.1.4",
    "typescript": "^4.0.5"
  },
  "devDependencies": {
    "@babel/core": "7.11.6",
    "@typescript-eslint/eslint-plugin": "^4.8.1",
    "@typescript-eslint/parser": "^4.8.1",
    "babel": "^6.23.0",
    "babel-jest": "^26.6.3",
    "babel-preset-gatsby": "^0.6.0",
    "core-js": "^3.7.0",
    "eslint": "^7.13.0",
    "eslint-config-airbnb": "^18.2.1",
    "eslint-config-prettier": "^6.15.0",
    "eslint-plugin-import": "2.22.1",
    "eslint-plugin-jsx-a11y": "6.4.1",
    "eslint-plugin-prettier": "^3.1.4",
    "eslint-plugin-react": "^7.21.5",
    "eslint-plugin-react-hooks": "4",
    "identity-obj-proxy": "^3.0.0",
    "jest": "^26.6.3",
    "mouseflow": "^1.0.3",
    "prettier": "2.1.2",
    "react-test-renderer": "16.12.0",
    "sentry": "^0.1.2",
    "stylelint": "^13.8.0",
    "stylelint-config-airbnb": "^0.0.0",
    "stylelint-config-recommended": "^3.0.0",
    "webpack": "^5.5.1"
  },
  "stylelint": {
    "extends": "stylelint-config-airbnb"
  },
  "prettier": {
    "arrowParens": "avoid",
    "semi": false,
    "printWidth": 100,
    "singleQuote": true
  },
  "eslintConfig": {
    "env": {
      "browser": true,
      "es2021": true,
      "es6": true,
      "jest": true,
      "node": true
    },
    "extends": [
      "airbnb-typescript/base",
      "eslint:recommended",
      "plugin:react/recommended",
      "plugin:@typescript-eslint/recommended",
      "prettier",
      "prettier/@typescript-eslint",
      "prettier/react"
    ],
    "plugins": [
      "prettier",
      "@typescript-eslint",
      "react"
    ],
    "parser": "@typescript-eslint/parser",
    "parserOptions": {
      "ecmaFeatures": {
        "jsx": true
      },
      "ecmaVersion": 12,
      "sourceType": "module",
      "project": "./tsconfig.json"
    },
    "root": true,
    "rules": {
      "prettier/prettier": [
        "error"
      ]
    }
  }
}

问题出在 CMS 集合中。

特别是这两行

filter: { field: 'Type', value: 'Webinar' }
fields:
  - label: 'Event Type'
    name: 'event_type'
    widget: 'select'
    multiple: false
    description: 'Event Type (Conference, Webinar, Workshop etc.)'
    options: ['Conference', 'Webinar', 'Workshop']

该字段被错误引用。