Last active
July 14, 2019 16:55
-
-
Save tygerbytes/c4e1d2db543649dac454015b3724a798 to your computer and use it in GitHub Desktop.
Netlify admin entrypoint
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!-- Add this before </body> --> | |
<script> | |
if (window.netlifyIdentity) { | |
window.netlifyIdentity.on("init", user => { | |
if (!user) { | |
window.netlifyIdentity.on("login", () => { | |
document.location.href = "/admin/"; | |
}); | |
} | |
}); | |
} | |
</script> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Typical Netlify CMS configuration for a Hugo-based blog | |
# (/static/admin/config.yml) | |
backend: | |
name: git-gateway | |
branch: master | |
# Where our media (usually images) content lives in the Git repository | |
media_folder: "static/img/uploads" | |
# Where our media is found in the live site | |
public_folder: "/img/uploads" | |
# The various content types for your site. | |
# Common options are "posts, blog, news" | |
# See https://www.netlifycms.org/docs/add-to-your-site/#collections | |
collections: | |
# Unique identifier for this collection | |
- name: post | |
# What this collection is called in the UI (i.e. friendly name) | |
label: Posts | |
# Where the content lives in our Git repository | |
folder: "content/post" | |
# Allow users to create new content? | |
create: true | |
# The relative URL for the post. | |
# Default is {{slug}}, a URL-safe version of the title | |
slug: "{{slug}}" | |
# The fields shown in the content editor. | |
# They correspond to fields in the front matter (except for 'body') | |
fields: | |
# Title of your posts | |
- {label: "Title", name: "title", widget: "string" } | |
- {label: "Last updated", name: "date", widget: "date" } | |
# (Alternative YAML syntax) | |
# 'label' is what we call this field in the UI. | |
# Makes it easier for your content creators to understand what the field is for, | |
# especially if your front matter uses strange names. | |
- label: "Original publish date" | |
# The name of the field in your front matter | |
name: "publishdate" | |
# The UI widget we use to display and interact with this field. | |
# See https://www.netlifycms.org/docs/widgets/ for widget documentation. | |
widget: "date" | |
# Summary field. The "text" widget handles multiline input. | |
- {label: "Summary", name: "description", widget: "text"} | |
# Our "draft" field uses the "boolean (true/false)" widget | |
# and attempts to make it's purpose clearer to content creators. | |
# We default it to "true" so we don't accidentally post rough drafts. | |
- {label: "Draft (not published)", name: "draft", widget: "boolean", default: true} | |
- {label: "Author", name: "author", widget: "string", default: "Joe Author"} | |
# Notice this "url" field uses the "hidden" widget, meaning that | |
# it won't appear in the UI, but it will still update our front matter. | |
- {label: "Link", name: "url", widget: "hidden", default: "{{slug}}"} | |
# These "categories" and "tags" fields use the "list" widget | |
- label: "Categories" | |
name: "categories" | |
required: true | |
widget: "list" | |
- label: "Tags" | |
name: "Tags" | |
widget: "list" | |
# body: Super important if you want to actually edit the content of your posts. :) | |
- label: "Article" | |
name: "body" | |
widget: "markdown" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!-- Add this somewhere before </head> --> | |
<script src="https://identity.netlify.com/v1/netlify-identity-widget.js"></script> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!-- This goes in /static/admin/index.html --> | |
<!doctype html> | |
<html> | |
<head> | |
<meta charset="utf-8" /> | |
<meta name="viewport" content="width=device-width, initial-scale=1.0" /> | |
<title>Content Manager</title> | |
</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> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment