add netlify cms

This commit is contained in:
2021-09-21 17:27:53 +08:00
parent 1f64b33b85
commit 0dedc852af
2 changed files with 64 additions and 0 deletions

49
static/admin/config.yml Normal file
View File

@@ -0,0 +1,49 @@
backend:
name: github
repo: Colin-XKL/Colinx-Blog
# This line should *not* be indented
publish_mode: editorial_workflow
# These lines should *not* be indented
media_folder: "static/images/uploads" # Media files will be stored in the repo under static/images/uploads
public_folder: "/images/uploads" # The src attribute for uploaded media will begin with /images/uploads
slug:
encoding: "unicode"
clean_accents: true
sanitize_replacement: "_"
collections:
- name: "blog" # Used in routes, e.g., /admin/collections/blog
label: "Blog" # Used in the UI
folder: "content/posts" # The path to the folder where the documents are stored
create: true # Allow users to create new documents in this collection
format: "frontmatter"
slug: "{{year}}-{{slug}}" # Filename template, e.g., YYYY-MM-DD-title.md
fields: # The fields for each document, usually in front matter
- { label: "Title", name: "title", widget: "string" }
- {
label: "Date",
name: "date",
widget: "datetime",
date_format: "YYYY-MM-DD",
time_format: "HH:mm",
preview: false,
}
- {
label: "Last Mod Date",
name: "lastmod",
widget: "datetime",
date_format: "YYYY-MM-DD",
time_format: "HH:mm",
preview: false,
required: false,
}
- {
label: "Featured Image",
name: "cover",
widget: "image",
required: false,
}
- { label: "Description", name: "description", widget: "text" }
- { label: "Draft", name: "draft", widget: "boolean", default: false }
- { label: "Categories", name: "categories", widget: "list" }
- { label: "Tags", name: "tags", widget: "list" }
- { label: "Body", name: "body", widget: "markdown" }

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

@@ -0,0 +1,15 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
</head>
<body>
<!-- Include the script that builds the page and powers Netlify CMS -->
<script src="https://cdn.jsdelivr.net/npm/netlify-cms@^2.0.0/dist/netlify-cms.js"></script>
</body>
</html>