added decapcms backend

This commit is contained in:
suroh 2023-10-26 12:06:12 +02:00
parent 866780f0db
commit b5726fb54c
4 changed files with 77 additions and 0 deletions

View File

@ -54,6 +54,8 @@ module.exports = (config) => {
// added passthrough for global assets
config.addPassthroughCopy('assets')
config.addPassthroughCopy('admin')
// added passthrough for images in their respective folders
config.addPassthroughCopy('_content/**/images/**')

View File

@ -20,6 +20,7 @@
<script async defer data-website-id="f24934aa-ee11-49ee-993f-a64b8df6a01c"
src="https://analytics.suroh.tk/umami.js"></script>
<script src="https://identity.netlify.com/v1/netlify-identity-widget.js"></script>
</head>
<body>
@ -32,4 +33,15 @@
{% block footer %}{% endblock %}
</div>
<script>
if (window.netlifyIdentity) {
window.netlifyIdentity.on("init", user => {
if (!user) {
window.netlifyIdentity.on("login", () => {
document.location.href = "/admin/";
});
}
});
}
</script>
</body>

45
admin/config.yml Normal file
View File

@ -0,0 +1,45 @@
backend:
name: gitea
repo: suroh/work.suroh.tk
app_id: 7bfaec5d-9c01-49bc-8c3c-d38ad5c7b16a
api_root: https://git.suroh.tk/api/v1
base_url: https://git.suroh.tk
site_domain: work.suroh.tk
branch: main
media_folder: "assets/media"
public_folder: "/assets/media"
# Please run "npx netlify-cms-proxy-server" for local backend
local_backend: false
collections:
- label: "work"
name: "work"
folder: "_content/work"
create: true
fields:
- { label: "title", name: "title", widget: "string" }
- { label: "layout", name: "layout", widget: "hidden", default: "page.njk" }
- { label: "body", name: "body", widget: "markdown" }
- { label: "feature image", name: "imgFeat", widget: "image", media_folder: "images" }
- { label: "gallery", name: "gallery", widget: "image", allow_multiple: true, media_folder: "images" }
- label: "audio"
name: "audio"
folder: "_content/audio"
create: true
fields:
- { label: "title", name: "title", widget: "string" }
- { label: "layout", name: "layout", widget: "hidden", default: "page.njk" }
- { label: "body", name: "body", widget: "markdown" }
- { label: "feature image", name: "imgFeat", widget: "image", media_folder: "images" }
- { label: "gallery", name: "gallery", widget: "image", allow_multiple: true, media_folder: "images" }
- label: "Settings"
name: "settings"
editor:
preview: false
files:
- label: "Meta Settings"
name: "settings"
file: "src/_data/settings.yaml"
fields:
- { label: Name, name: name, widget: string }
- { label: Author, name: author, widget: string }
- { label: URL, name: url, widget: string }

18
admin/index.html Normal file
View File

@ -0,0 +1,18 @@
<!doctype html>
<html>
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<meta name="robots" content="noindex" />
<title>Content Manager</title>
<script src="https://identity.netlify.com/v1/netlify-identity-widget.js"></script>
</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>