Skip to content

Commit

Permalink
Add Netlify Identity/CMS support (#7)
Browse files Browse the repository at this point in the history
* Update head.html.twig
* Create index.html.twig
  • Loading branch information
ArnaudLigny authored Dec 27, 2017
1 parent 31a6616 commit 37aff97
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 0 deletions.
16 changes: 16 additions & 0 deletions layouts/admin/index.html.twig
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<!doctype html>
<html>
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>{{ page.title|default('Content Manager') }}</title>
<!-- Include the styles for the Netlify CMS UI, after your own styles -->
<link rel="stylesheet" href="https://unpkg.com/netlify-cms@{{ site.netlify.cms.version|default('latest') }}/dist/cms.css" />
</head>
<body>
<!-- Include the script that builds the page and powers Netlify CMS -->
<script src="https://unpkg.com/netlify-cms@{{ site.netlify.cms.version|default('latest') }}/dist/cms.js"></script>
<!-- Use Netlify Identity -->
<script src="https://identity-js.netlify.com/{{ site.netlify.identity.version|default('v1') }}/netlify-identity-widget.js"></script>
</body>
</html>
13 changes: 13 additions & 0 deletions layouts/include/head.html.twig
Original file line number Diff line number Diff line change
Expand Up @@ -25,4 +25,17 @@
<link rel="stylesheet" href="https://highlightjs.org/static/demo/styles/monokai_sublime.css">
<script src="https://highlightjs.org/static/highlight.pack.js"></script>
<script>hljs.initHighlightingOnLoad();</script>
<!-- Netlify Identity -->
<script src="https://identity.netlify.com/{{ site.netlify.identity.version|default('v1') }}/netlify-identity-widget.js"></script>
<script>
if (window.netlifyIdentity) {
window.netlifyIdentity.on("init", user => {
if (!user) {
window.netlifyIdentity.on("login", () => {
document.location.href = "/{{ site.netlify.cms.path|default('admin') }}/";
});
}
});
}
</script>
</head>

0 comments on commit 37aff97

Please sign in to comment.