Skip to content

Commit 20b123a

Browse files
committed
netlify identity
1 parent 5723dbd commit 20b123a

File tree

3 files changed

+18
-0
lines changed

3 files changed

+18
-0
lines changed

static/admin/index.html

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
<meta charset="utf-8" />
55
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
66
<title>Content Manager</title>
7+
<script src="https://identity.netlify.com/v1/netlify-identity-widget.js"></script>
78
</head>
89
<body>
910
<!-- Include the script that builds the page and powers Netlify CMS -->

themes/algorithmica/layouts/_default/baseof.html

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,5 +11,18 @@
1111
{{ partial "nextprev.html" . }}
1212
</main>
1313
{{- partial "footer.html" . -}}
14+
{{ if .IsHome }}
15+
<script>
16+
if (window.netlifyIdentity) {
17+
window.netlifyIdentity.on("init", user => {
18+
if (!user) {
19+
window.netlifyIdentity.on("login", () => {
20+
document.location.href = "/admin/";
21+
});
22+
}
23+
});
24+
}
25+
</script>
26+
{{ end }}
1427
</body>
1528
</html>

themes/algorithmica/layouts/partials/head.html

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
11
<head>
22
{{- partial "analytics.html" -}}
33

4+
{{ if .IsHome }}
5+
<script src="https://identity.netlify.com/v1/netlify-identity-widget.js"></script>
6+
{{ end }}
7+
48
<meta charset="utf-8">
59

610
{{ $style := resources.Get "style.sass" | toCSS | minify | fingerprint }}

0 commit comments

Comments
 (0)