Skip to content

Commit

Permalink
Add Netlify Identity Widget
Browse files Browse the repository at this point in the history
  • Loading branch information
queerformacio committed Jan 25, 2024
1 parent b4c8488 commit a6a229b
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
2 changes: 1 addition & 1 deletion _includes/head.html
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<head>
<script src="https://identity.netlify.com/v1/netlify-identity-widget.js"></script>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta name="theme-color" media="(prefers-color-scheme: light)" content="#f7f7f7">
<meta name="theme-color" media="(prefers-color-scheme: dark)" content="#1b1b1e">
Expand Down Expand Up @@ -95,7 +96,6 @@
{% if page.layout == 'page' or page.layout == 'post' %}
<!-- Manific Popup -->
<link rel="stylesheet" href="{{ site.data.origin[type].magnific-popup.css | relative_url }}">
<link rel="stylesheet" href="{{ site.baseurl }}/css/override.css" />
{% endif %}

<!-- JavaScript -->
Expand Down
12 changes: 12 additions & 0 deletions admin/index.html
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
<!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" />
<meta name="robots" content="noindex" />
Expand All @@ -9,5 +10,16 @@
<body>
<!-- Include the script that builds the page and powers Decap CMS -->
<script src="https://unpkg.com/decap-cms@^3.0.0/dist/decap-cms.js"></script>
<script>
if (window.netlifyIdentity) {
window.netlifyIdentity.on("init", user => {
if (!user) {
window.netlifyIdentity.on("login", () => {
document.location.href = "/admin/";
});
}
});
}
</script>
</body>
</html>

0 comments on commit a6a229b

Please # to comment.