Merge pull request #1 from prayashkrsaha/prayashkrsaha-netlify-cms-test

Create index.html, config.yaml
updated netlify.toml
This commit is contained in:
prayashkrsaha 2024-08-12 00:36:44 +05:30 committed by GitHub
commit 9e9bdeef97
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 45 additions and 1 deletions

View File

@ -24,3 +24,8 @@
debug = true debug = true
# Relative path to source directory in case you use Hugo's "--s" option # Relative path to source directory in case you use Hugo's "--s" option
srcdir = "exampleSite" srcdir = "exampleSite"
[[redirects]]
from = "/admin/*"
to = "/admin/index.html"
status = 200

17
static/admin/config.yaml Normal file
View File

@ -0,0 +1,17 @@
backend:
name: git-gateway
branch: master # or main if you're using a different default branch
media_folder: "static/images/uploads" # Media files will be stored here
public_folder: "/images/uploads"
collections:
- name: "blog"
label: "Blog"
folder: "content/blog"
create: true
slug: "{{year}}-{{month}}-{{day}}-{{slug}}"
fields:
- { label: "Title", name: "title", widget: "string" }
- { label: "Date", name: "date", widget: "datetime" }
- { label: "Body", name: "body", widget: "markdown" }

22
static/admin/index.html Normal file
View File

@ -0,0 +1,22 @@
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>Content Manager</title>
<script src="https://identity.netlify.com/v1/netlify-identity-widget.js"></script>
<script src="https://unpkg.com/netlify-cms@^2.0.0/dist/netlify-cms.js"></script>
</head>
<body>
<script>
if (window.netlifyIdentity) {
window.netlifyIdentity.on("init", user => {
if (!user) {
window.netlifyIdentity.on("login", () => {
document.location.href = "/admin/";
});
}
});
}
</script>
</body>
</html>