mirror of
https://github.com/CaiJimmy/hugo-theme-stack.git
synced 2025-04-29 03:53:30 +08:00
Merge pull request #1 from prayashkrsaha/prayashkrsaha-netlify-cms-test
Create index.html, config.yaml updated netlify.toml
This commit is contained in:
commit
9e9bdeef97
@ -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
17
static/admin/config.yaml
Normal 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
22
static/admin/index.html
Normal 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>
|
Loading…
Reference in New Issue
Block a user