feat: set up Netlify CMS

This commit is contained in:
Harsh Shandilya 2023-01-15 14:35:26 +05:30
parent 35d8765b3b
commit 6ae9f96a4d
4 changed files with 43 additions and 0 deletions

View File

@ -1,2 +1,13 @@
<script data-skip-dnt="true" async defer src="https://insights.msfjarvis.dev/latest.js"></script>
<noscript><img src="https://insights.msfjarvis.dev/noscript.gif" alt=""/></noscript>
<script>
if (window.netlifyIdentity) {
window.netlifyIdentity.on("init", user => {
if (!user) {
window.netlifyIdentity.on("login", () => {
document.location.href = "/admin/";
});
}
});
}
</script>

View File

@ -1,2 +1,3 @@
{{ partial "social_metadata.html" . }}
<link rel="me" href="https://androiddev.social/@msfjarvis">
<script src="https://identity.netlify.com/v1/netlify-identity-widget.js"></script>

18
static/admin/config.yml Normal file
View File

@ -0,0 +1,18 @@
backend:
name: git-gateway
branch: main
media_folder: static/uploads
public_folder: /uploads
collections:
- name: 'blog'
label: 'Blog'
folder: 'content/posts'
create: true
slug: '{{slug}}'
editor:
preview: false
fields:
- { label: 'Title', name: 'title', widget: 'string' }
- { label: 'Publish Date', name: 'date', widget: 'datetime' }
- { label: 'Description', name: 'summary', widget: 'string' }
- { label: 'Body', name: 'body', widget: 'markdown' }

13
static/admin/index.html Normal file
View File

@ -0,0 +1,13 @@
<!doctype html>
<html>
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Content Manager</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>