aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMathias Biilmann Christensen <info@mathias-biilmann.net>2017-09-02 14:08:54 -0700
committerMathias Biilmann Christensen <info@mathias-biilmann.net>2017-09-02 14:08:54 -0700
commit2385c63edd389348d2412bab1749409303b9b22f (patch)
tree5f56c8ec316e6d2099a70c1c9712ace19f36669e
parentf70a7350a503c9e85190a835ef77b938dad63dc4 (diff)
Setup cms with netlify identity
-rw-r--r--gulpfile.babel.js21
-rw-r--r--site/static/admin/config.yml (renamed from src/cms/config.yml)7
-rw-r--r--site/static/admin/index.html (renamed from src/cms/index.html)0
3 files changed, 6 insertions, 22 deletions
diff --git a/gulpfile.babel.js b/gulpfile.babel.js
index 77e0670..a50a03c 100644
--- a/gulpfile.babel.js
+++ b/gulpfile.babel.js
@@ -19,23 +19,7 @@ const defaultArgs = ["-d", "../dist", "-s", "site"];
gulp.task("hugo", (cb) => buildSite(cb));
gulp.task("hugo-preview", (cb) => buildSite(cb, ["--buildDrafts", "--buildFuture"]));
-
-gulp.task("cms", () => {
- const match = process.env.REPOSITORY_URL ? process.env.REPOSITORY_URL : cp.execSync("git remote -v", {encoding: "utf-8"});
- let repo = null;
- match.replace(/github.com[:/](\S+)(\.git)?/, (_, m) => {
- repo = m.replace(/\.git$/, "");
- });
- gulp.src("./src/cms/*")
- .pipe(replace("<% GITHUB_REPOSITORY %>", repo))
- .pipe(gulp.dest("./dist/admin"))
- .pipe(browserSync.stream());
- gulp.src(["./node_modules/netlify-cms/dist/*.*", "!./node_modules/netlify-cms/dist/*.html"])
- .pipe(gulp.dest("./dist"))
- .pipe(browserSync.stream())
-});
-
-gulp.task("build", ["css", "js", "hugo", "cms"]);
+gulp.task("build", ["css", "js", "hugo"]);
gulp.task("build-preview", ["css", "js", "hugo-preview"]);
gulp.task("css", () => (
@@ -79,7 +63,7 @@ gulp.task("svg", () => {
.pipe(gulp.dest("site/layouts/partials/"));
});
-gulp.task("server", ["hugo", "css", "js", "svg", "cms"], () => {
+gulp.task("server", ["hugo", "css", "js", "svg"], () => {
browserSync.init({
server: {
baseDir: "./dist"
@@ -87,7 +71,6 @@ gulp.task("server", ["hugo", "css", "js", "svg", "cms"], () => {
});
gulp.watch("./src/js/**/*.js", ["js"]);
gulp.watch("./src/css/**/*.css", ["css"]);
- gulp.watch("./src/cms/*", ["cms"]);
gulp.watch("./site/static/img/icons/*.svg", ["svg"]);
gulp.watch("./site/**/*", ["hugo"]);
});
diff --git a/src/cms/config.yml b/site/static/admin/config.yml
index 89af1d6..12b9196 100644
--- a/src/cms/config.yml
+++ b/site/static/admin/config.yml
@@ -1,7 +1,8 @@
backend:
- name: github
- repo: <% GITHUB_REPOSITORY %> # Gulp will replace this with your GitHub repository
- branch: master # Branch to update (master by default)
+ name: netlify-auth
+ auth_url: "/.netlify/identity"
+ github_proxy_url: "/.netlify/git/github"
+ accept_roles: ['admin', 'cms']
media_folder: "site/static/img" # Folder where user uploaded files should go
public_folder: "img"
diff --git a/src/cms/index.html b/site/static/admin/index.html
index efa668b..efa668b 100644
--- a/src/cms/index.html
+++ b/site/static/admin/index.html