我在GitHub 上有一个Vuepress存储库,我正在尝试使用NetlifyCMS,但没有选择在Netlify网站上进行分解。
我可以使用 config.yml 和 index.html 文件毫无问题地安装 CMS,但是如果我转到 www.site.com/admin,我会收到 API 错误 -无法加载条目:API_ERROR:未找到
如果我在 GitHub 上创建 OAuth 应用程序,我可以使用https://api.netlify.com/auth/done授权回调 URL 并在 Netlify 上使用客户端 ID 和客户端密码设置它,但不会收到 API 错误我只想要 Netlify 的 CMS 选项。可能吗?
我试图检查文档,但我迷路了:
https://www.netlifycms.org/docs/add-to-your-site/
https://www.netlifycms.org/docs/authentication-backends/
管理服务的文件夹结构:
.vuepress
|_public
|_admin
|_config.yml
|_index.html
内部管理文件夹:
配置.yml:
backend:
name: github
accept_roles: #optional - accepts all users if left out
- admin
- editor
repo: "Company/repositoryName"
branch: master # Branch to update (optional; defaults to master)
publish_mode: editorial_workflow
media_folder: "/.vuepress/public/images"
public_folder: "/images"
collections:
- name: "docs" # Used in routes, e.g., /admin/collections/blog
label: "Docs" # Used in the UI
folder: "docs" # The path to the folder where the documents are stored
create: true # Allow users to create new documents in this collection
slug: "{{slug}}" # Filename template, e.g., YYYY-MM-DD-title.md
fields: # The fields for each document, usually in front matter
- {label: "Title", name: "title", widget: "string"}
- {label: "Body", name: "body", widget: "markdown"}
索引.html
<!doctype html>
<html>
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Content Manager</title>
</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>