Skip to content

Commit

Permalink
adding netlify-cms
Browse files Browse the repository at this point in the history
  • Loading branch information
sujaykundu777 committed May 23, 2020
1 parent d4f0951 commit 5604f88
Show file tree
Hide file tree
Showing 5 changed files with 52 additions and 6 deletions.
12 changes: 6 additions & 6 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ GEM
algoliasearch (1.27.2)
httpclient (~> 2.8, >= 2.8.3)
json (>= 1.5.1)
backports (3.17.1)
backports (3.17.2)
colorator (1.1.0)
concurrent-ruby (1.1.6)
devlopr (0.4.5)
Expand All @@ -34,7 +34,7 @@ GEM
httpclient (2.8.3)
i18n (1.8.2)
concurrent-ruby (~> 1.0)
jekyll (4.0.0)
jekyll (4.0.1)
addressable (~> 2.4)
colorator (~> 1.0)
em-websocket (~> 0.5)
Expand Down Expand Up @@ -104,8 +104,8 @@ GEM
pathutil (0.16.2)
forwardable-extended (~> 2.6)
progressbar (1.10.1)
public_suffix (4.0.4)
puma (4.3.3)
public_suffix (4.0.5)
puma (4.3.5)
nio4r (~> 2.0)
rack (1.6.13)
rack-jekyll (0.5.0)
Expand All @@ -117,11 +117,11 @@ GEM
rack-test (1.1.0)
rack (>= 1.0, < 3)
rake (13.0.1)
rb-fsevent (0.10.3)
rb-fsevent (0.10.4)
rb-inotify (0.10.1)
ffi (~> 1.0)
rexml (3.2.4)
rouge (3.18.0)
rouge (3.19.0)
safe_yaml (1.0.5)
sassc (2.3.0)
ffi (~> 1.9)
Expand Down
3 changes: 3 additions & 0 deletions _includes/head.html
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,9 @@
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/instantsearch.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/moment.js/2.20.1/moment.min.js"></script>

<!-- Netlify CMS -->
<script src="https://identity.netlify.com/v1/netlify-identity-widget.js"></script>

<!-- Github Button -->
<script async defer src="https://buttons.github.io/buttons.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.3/umd/popper.min.js"
Expand Down
11 changes: 11 additions & 0 deletions _layouts/default.html
Original file line number Diff line number Diff line change
Expand Up @@ -28,5 +28,16 @@
<div hidden id="snipcart" data-api-key="Y2I1NTAyNWYtMTNkMy00ODg0LWE4NDItNTZhYzUxNzJkZTI5NjM3MDI4NTUzNzYyMjQ4NzU0"></div>
<script src="https://cdn.snipcart.com/themes/v3.0.0-beta.3/default/snipcart.js" defer></script>
<script src="/assets/js/mode-switcher.js"></script>
<script>
if (window.netlifyIdentity) {
window.netlifyIdentity.on("init", user => {
if (!user) {
window.netlifyIdentity.on("login", () => {
document.location.href = "/admin/";
});
}
});
}
</script>
</body>
</html>
19 changes: 19 additions & 0 deletions assets/admin/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
backend:
name: git-gateway
branch: master

media_folder: "assets/img/posts" # Media files will be stored in the repo under images/uploads
# public_folder: "/assets/img/posts" # The src attribute for uploaded media will begin with /images/uploads

collections:
- name: "blog" # Used in routes, e.g., /admin/collections/blog
label: "Blog" # Used in the UI
folder: "_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: "Body", name: "body", widget: "markdown"}
13 changes: 13 additions & 0 deletions assets/admin/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<!doctype html>
<html>
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>devlopr - Admin</title>
<script src="https://identity.netlify.com/v1/netlify-identity-widget.js"></script>
</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 5604f88

Please sign in to comment.