是否可以仅在Vuepress中使用Netlify CMS,而不能在Netlify上部署

时间:2019-04-08 00:46:45

标签: netlify vuepress

我在 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上使用Client ID和Client Secret对其进行设置,但我不会获得该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

内部管理文件夹:

config.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"}

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>
</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>

0 个答案:

没有答案
相关问题