Permalink
Browse files

add netlify cms

  • Loading branch information...
henryhoo committed Jan 7, 2019
1 parent f0a8ade commit 0a4c1b166feba74eaf72ef6b66b9aab8a22464f8
Showing with 52 additions and 0 deletions.
  1. +3 −0 _config.yml
  2. +12 −0 source/_data/head.swig
  3. +24 −0 source/admin/config.yml
  4. +13 −0 source/admin/index.html
@@ -26,6 +26,7 @@ category_dir: categories
code_dir: downloads/code
i18n_dir: :lang
skip_render:
- "*admin/*"

# 自动生成sitemap
sitemap:
@@ -96,6 +97,8 @@ deploy:
email: [497018787@qq.com]

theme_config:
custom_file_path:
head: source/_data/head.swig
url: http://www.jiaxi.io
baidu_site_verification: FKCjZBAwDZ
baidu_analytics: 5cb1205e2ee7921b3a3636edfe6a588a
@@ -0,0 +1,12 @@
<script src="https://identity.netlify.com/v1/netlify-identity-widget.js"></script>
<script>
if (window.netlifyIdentity) {
window.netlifyIdentity.on("init", user => {
if (!user) {
window.netlifyIdentity.on("login", () => {
document.location.href = "/admin/";
});
}
});
}
</script>
@@ -0,0 +1,24 @@
backend:
name: git-gateway
branch: master # Branch to update (optional; defaults to master)

# adds an interface for drafting, reviewing, and approving posts.
# publish_mode: editorial_workflow

# Netlify CMS allows users to upload images directly within the editor. For this to work, the CMS needs to know where to save them
media_folder: "source/images/uploads" # Media files will be stored in the repo under images/uploads
public_folder: "/images/uploads"

collections:
- name: "posts" # Used in routes, e.g., /admin/collections/blog
label: "Posts" # Used in the UI
folder: "source/_posts" # The path to the folder where the documents are stored
create: true # Allow users to create new documents in this collection
slug: "{{year}}-{{month}}-{{day}}-{{slug}}" # Filename template, e.g., YYYY-MM-DD-title.md
fields: # The fields for each document, usually in front matter
- {label: "Layout", name: "layout", widget: "hidden", default: "blog"}
- {label: "Title", name: "title", widget: "string"}
- {label: "Publish Date", name: "date", widget: "datetime"}
- {label: "Featured Image", name: "thumbnail", widget: "image"}
- {label: "Rating (scale of 1-5)", name: "rating", widget: "number"}
- {label: "Body", name: "body", widget: "markdown"}
@@ -0,0 +1,13 @@
<!doctype html>
<html>
<head>
<script src="https://identity.netlify.com/v1/netlify-identity-widget.js"></script>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Content Manager</title>
</head>
<body>
<!-- Include the script that builds the page and powers Netlify CMS -->
<script src="https://unpkg.com/netlify-cms@^2.0.0/dist/netlify-cms.js"></script>
</body>
</html>

0 comments on commit 0a4c1b1

Please sign in to comment.