0

我正在尝试将 Netlify CMS 集成到静态 Pelican 网站。由于出现以下错误,我似乎无法访问 /admin:

Error: Failed to load config.yml
Check your config.yml file.

这是 admin/index.html 的内容(我按照这些说明进行操作)

<!doctype html>
<html>
<head>
  <meta charset="utf-8" />
  <meta name="viewport" content="width=device-width, initial-scale=1.0" />
  <title>Content Manager</title>
  <script src="https://identity.netlify.com/v1/netlify-identity-widget.js"></script>
</head>
<body>
  <!-- Include the script that builds the page and powers Netlify CMS -->
  <script src="https://unpkg.com/netlify-cms@^2.0.0/dist/netlify-cms.js"></script>
</body>
</html>

这是我的 config.yaml 的内容

backend:
  name: github-getaway
  branch: master

media_folder: "img/uploads" # Folder where user uploaded files should go
public_folder: "uploads"

collections: # A list of collections the CMS should be able to edit
  - name: "post" # Used in routes, ie.: /admin/collections/:slug/edit
    label: "Article" # Used in the UI, ie.: "New Post"
    folder: "content/news" # The path to the folder where the documents are stored
    format: markdown
    sort: "date:desc" # Default is title:asc
    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", tagname: "h2", class: "entry-title"}
      - {label: "Body", name: "body", widget: "markdown"}
    meta: # Meta data fields. Just like fields, but without any preview element
      - {label: "Publish Date", name: "date", widget: "datetime"}
      - {label: "Category", name: "category", widget: "string", default: "News"}

如果需要,该网站的网址是https://distracted-engelbart-20e42f.netlify.com

关于我在这里做错了什么的任何想法?

4

1 回答 1

1

这篇文章已经有几个月了,所以我猜你有这个工作吗?

我必须将管理文件添加到STATIC_PATHS变量中pelicanconf.py

STATIC_PATHS = [
    'admin/index.html',
    'admin/config.yml',
    'images',
    'extra'
]

这是我与 Netlify CMS 集成的示例 repo https://github.com/marcus-clements/pelican-netlify-cms

于 2020-05-10T14:20:08.963 回答