How to Add Decap CMS to Docusaurus
· 2 min read
Decap CMS is a Git-based CMS. It gives you a browser-based editor for your Docusaurus site — no backend needed.
Here's how to add it.
Why Decap CMS?
- Git-based — content lives in your repo
- No backend — no server to maintain
- Free — runs from a CDN
- Open source — no lock-in
Step 1 — Create the Admin Files
Create two files:
static/admin/index.html
static/admin/config.yml
static/admin/index.html:
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<title>Content Manager</title>
</head>
<body>
<script src="https://unpkg.com/decap-cms@^3.0.0/dist/decap-cms.js"></script>
</body>
</html>
static/admin/config.yml:
backend:
name: proxy
proxy_url: http://localhost:8081/api/v1
branch: main
local_backend: true
media_folder: "static/img"
public_folder: "/img"
collections:
- name: "blog"
label: "Blog Posts"
folder: "blog"
create: true
fields:
- { label: "Title", name: "title", widget: "string" }
- { label: "Body", name: "body", widget: "markdown" }
Step 2 — Run Locally
Open two terminals:
Terminal 1:
npx decap-server
Terminal 2:
npm start
Open:
http://localhost:3000/admin/index.html
Step 3 — Log In
Click Login. No password required in local mode.
Step 4 — Edit Content
- Click a collection
- Click a file
- Edit the fields
- Click Save
What Nocturne Adds
Nocturne ships with Decap CMS pre-configured for:
- Site settings
- Navbar & footer
- Sidebar widgets
- Homepage content
- Documentation
- Blog posts
No setup required.