Is it possible to use the Netlify CMS only with Vu

2019-08-16 23:22发布

问题:

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>