Is it possible to use the Netlify CMS only with Vuepress but without deploying on Netlify

寵の児 提交于 2019-12-13 20:52:43

问题


I have a Vuepress repository on GitHub and I'm trying to use NetlifyCMS without the option to depoly on the Netlify website.

I can install the CMS without problems, with the config.yml and index.html files but if I go to www.site.com/admin I get the API error - Failed to load entry: API_ERROR: Not Found

If I create the OAuth App on GitHub I can use the https://api.netlify.com/auth/done Authorization callback URL and set up it with the Client ID and Client Secret on Netlify I won't get the API error but I only want the CMS option from Netlify. Is it possible?

I was trying to check the documentation but I got lost:

https://www.netlifycms.org/docs/add-to-your-site/

https://www.netlifycms.org/docs/authentication-backends/

The folder structure for admin services:

.vuepress
   |_public
        |_admin
            |_config.yml
            |_index.html

Inside admin folder:

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>

来源:https://stackoverflow.com/questions/55564958/is-it-possible-to-use-the-netlify-cms-only-with-vuepress-but-without-deploying-o

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!