decap-cms icon indicating copy to clipboard operation
decap-cms copied to clipboard

Error loading the CMS configuration with Docusaurus

Open jerdog opened this issue 1 month ago • 1 comments

I have the index.html file in /static/admin:

<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 Decap CMS -->
  <script src="https://unpkg.com/decap-cms@^3.0.0/dist/decap-cms.js"></script>
</body>
</html>

and the config.yml file in /static/admin:

backend:
  name: github
  repo: my-repo
  branch: "dev"
publish_mode: editorial_workflow
media_folder: "static/img"
public_folder: "/img/"
collections:
  - name: docs
    label: "docs"
    folder: docs
    identifier_field: title
    extension: md
    widget: "list"
    create: true
    slug: "{{slug}}"
    sortable_fields: ["title"]
    fields:
      - { label: "Title", name: "title", widget: "string", required: true }
      - { label: "Sidebar Label", name: "sidebar_label", widget: "string", required: true }
      - { label: "Sidebar Position", name: "sidebar_position", widget: "number", required: true }
      - { label: "Author", name: "author", widget: "string", required: true }
      - { label: "Body", name: "body", widget: "markdown", required: true }

When I build the docusaurus site, and then load https://my-site/admin I get the following:

Error loading the CMS configuration
Config Errors:
YAMLSyntaxError: All collection items must start at the same column at line 1, column 1:

<!DOCTYPE html>
^^^^^^^^^^^^^^^…
Check your config.yml file.

Console:

decap-cms-app 3.9.0
decap-cms-core 3.9.0
decap-cms 3.9.0
config.js:353 Response for config.yml was not yaml. (Content-Type: text/html; charset=utf-8)
parse-cst.js:360  Uncaught (in promise) YAMLSyntaxError: All collection items must start at the same column at line 1, column 1:

<!DOCTYPE html>
^^^^^^^^^^^^^^^…

I'm at a loss....

jerdog avatar Dec 08 '25 17:12 jerdog

This is a guess: maybe Decap thinks your config.yml is an HTML file? I would check the headers if it returns yml, not html.

martinjagodic avatar Dec 08 '25 17:12 martinjagodic