Skip to content
This repository has been archived by the owner on Sep 9, 2024. It is now read-only.

Commit

Permalink
Update to version 2.0.0
Browse files Browse the repository at this point in the history
  • Loading branch information
KaneFreeman committed Apr 21, 2023
1 parent 1532e93 commit 862d2a3
Show file tree
Hide file tree
Showing 5 changed files with 1,572 additions and 1,013 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
"main": "index.js",
"dependencies": {
"date-fns": "2.29.3",
"@staticcms/core": "1.2.12",
"@staticcms/core": "2.0.0",
"react": "18.2.0",
"react-dom": "18.2.0",
"to-string-loader": "1.2.0"
Expand Down
168 changes: 85 additions & 83 deletions site/static/admin/config.yml
Original file line number Diff line number Diff line change
@@ -1,83 +1,85 @@
backend:
name: git-gateway
branch: main

media_folder: "site/static/img" # Folder where user uploaded files should go
public_folder: "/img"

collections: # A list of collections the CMS should be able to edit
- name: "post" # Used in routes, ie.: /admin/collections/:slug/edit
label: "Post" # Used in the UI, ie.: "New Post"
folder: "site/content/post" # The path to the folder where the documents are stored
create: true # Allow users to create new documents in this collection
fields: # The fields each document in this collection have
- {label: "Title", name: "title", widget: "string"}
- {label: "Publish Date", name: "date", widget: "datetime"}
- {label: "Intro Blurb", name: "description", widget: "text"}
- {label: "Image", name: "image", widget: "image", required: false}
- {label: "Body", name: "body", widget: "markdown"}
- name: "pages"
label: "Pages"
files:
- file: "site/content/_index.md"
label: "Home Page"
name: "home"
fields:
- {label: Title, name: title, widget: string}
- {label: Subtitle, name: subtitle, widget: string}
- {label: Image, name: image, widget: image}
- {label: "Blurb", name: blurb, widget: object, fields: [
{label: "Heading", name: "heading", widget: string},
{label: "Text", name: "text", widget: "text"}]}
- {label: "Intro", name: intro, widget: object, fields: [
{label: "Heading", name: "heading", widget: string},
{label: "Text", name: "text", widget: "text"}]}
- {label: "Products", name: products, widget: list, fields: [
{label: "Image", name: "image", widget: "image"},
{label: "Text", name: "text", widget: "text"}]}
- {label: "Values", name: "values", widget: "object", fields: [
{label: "Heading", name: "heading", widget: string},
{label: "Text", name: "text", widget: "text"}]}
- file: "site/content/contact/_index.md"
label: "Contact Page"
name: "contact"
fields:
- {label: Title, name: title, widget: string}
- {label: Logo, name: logo, widget: image}
- {label: Body, name: body, widget: markdown}
- label: Contact Entries
name: contact_entries
widget: list
fields:
- label: Heading
name: heading
widget: string
- label: Text
name: text
widget: text
- file: "site/content/products/_index.md"
label: "Products Page"
name: "products"
fields:
- {label: Title, name: title, widget: string}
- {label: Image, name: image, widget: image}
- {label: Heading, name: heading, widget: string}
- {label: Description, name: description, widget: string}
- {label: Intro, name: intro, widget: object, fields: [{label: Heading, name: heading, widget: string}, {label: Description, name: description, widget: text}, {label: Blurbs, name: blurbs, widget: list, fields: [{label: Image, name: image, widget: image}, {label: Text, name: text, widget: text}]}]}
- {label: Main, name: main, widget: object, fields: [{label: Heading, name: heading, widget: string}, {label: Description, name: description, widget: text}, {label: Image1, name: image1, widget: object, fields: [{label: Image, name: image, widget: image}, {label: Alt, name: alt, widget: string}]}, {label: Image2, name: image2, widget: object, fields: [{label: Image, name: image, widget: image}, {label: Alt, name: alt, widget: string}]}, {label: Image3, name: image3, widget: object, fields: [{label: Image, name: image, widget: image}, {label: Alt, name: alt, widget: string}]}]}
- {label: Testimonials, name: testimonials, widget: list, fields: [{label: Quote, name: quote, widget: string}, {label: Author, name: author, widget: string}]}
- {label: Full_image, name: full_image, widget: image}
- {label: Pricing, name: pricing, widget: object, fields: [{label: Heading, name: heading, widget: string}, {label: Description, name: description, widget: string}, {label: Plans, name: plans, widget: list, fields: [{label: Plan, name: plan, widget: string}, {label: Price, name: price, widget: string}, {label: Description, name: description, widget: string}, {label: Items, name: items, widget: list}]}]}
- file: "site/content/values/_index.md"
label: "Values Page"
name: "values"
fields:
- {label: Title, name: title, widget: string}
- {label: Image, name: image, widget: image}
- label: Values
name: values
widget: list
fields:
- {label: Heading, name: heading, widget: string}
- {label: Text, name: text, widget: text}
- {label: Image, name: imageUrl, widget: image}
backend:
name: git-gateway
branch: main

media_folder: "site/static/img" # Folder where user uploaded files should go
public_folder: "/img"

local_backend: true

collections: # A list of collections the CMS should be able to edit
- name: "post" # Used in routes, ie.: /admin/collections/:slug/edit
label: "Post" # Used in the UI, ie.: "New Post"
folder: "site/content/post" # The path to the folder where the documents are stored
create: true # Allow users to create new documents in this collection
fields: # The fields each document in this collection have
- {label: "Title", name: "title", widget: "string"}
- {label: "Publish Date", name: "date", widget: "datetime"}
- {label: "Intro Blurb", name: "description", widget: "text"}
- {label: "Image", name: "image", widget: "image", required: false}
- {label: "Body", name: "body", widget: "markdown"}
- name: "pages"
label: "Pages"
files:
- file: "site/content/_index.md"
label: "Home Page"
name: "home"
fields:
- {label: Title, name: title, widget: string}
- {label: Subtitle, name: subtitle, widget: string}
- {label: Image, name: image, widget: image}
- {label: "Blurb", name: blurb, widget: object, fields: [
{label: "Heading", name: "heading", widget: string},
{label: "Text", name: "text", widget: "text"}]}
- {label: "Intro", name: intro, widget: object, fields: [
{label: "Heading", name: "heading", widget: string},
{label: "Text", name: "text", widget: "text"}]}
- {label: "Products", name: products, widget: list, fields: [
{label: "Image", name: "image", widget: "image"},
{label: "Text", name: "text", widget: "text"}]}
- {label: "Values", name: "values", widget: "object", fields: [
{label: "Heading", name: "heading", widget: string},
{label: "Text", name: "text", widget: "text"}]}
- file: "site/content/contact/_index.md"
label: "Contact Page"
name: "contact"
fields:
- {label: Title, name: title, widget: string}
- {label: Logo, name: logo, widget: image}
- {label: Body, name: body, widget: markdown}
- label: Contact Entries
name: contact_entries
widget: list
fields:
- label: Heading
name: heading
widget: string
- label: Text
name: text
widget: text
- file: "site/content/products/_index.md"
label: "Products Page"
name: "products"
fields:
- {label: Title, name: title, widget: string}
- {label: Image, name: image, widget: image}
- {label: Heading, name: heading, widget: string}
- {label: Description, name: description, widget: string}
- {label: Intro, name: intro, widget: object, fields: [{label: Heading, name: heading, widget: string}, {label: Description, name: description, widget: text}, {label: Blurbs, name: blurbs, widget: list, fields: [{label: Image, name: image, widget: image}, {label: Text, name: text, widget: text}]}]}
- {label: Main, name: main, widget: object, fields: [{label: Heading, name: heading, widget: string}, {label: Description, name: description, widget: text}, {label: Image1, name: image1, widget: object, fields: [{label: Image, name: image, widget: image}, {label: Alt, name: alt, widget: string}]}, {label: Image2, name: image2, widget: object, fields: [{label: Image, name: image, widget: image}, {label: Alt, name: alt, widget: string}]}, {label: Image3, name: image3, widget: object, fields: [{label: Image, name: image, widget: image}, {label: Alt, name: alt, widget: string}]}]}
- {label: Testimonials, name: testimonials, widget: list, fields: [{label: Quote, name: quote, widget: string}, {label: Author, name: author, widget: string}]}
- {label: Full_image, name: full_image, widget: image}
- {label: Pricing, name: pricing, widget: object, fields: [{label: Heading, name: heading, widget: string}, {label: Description, name: description, widget: string}, {label: Plans, name: plans, widget: list, fields: [{label: Plan, name: plan, widget: string}, {label: Price, name: price, widget: string}, {label: Description, name: description, widget: string}, {label: Items, name: items, widget: list}]}]}
- file: "site/content/values/_index.md"
label: "Values Page"
name: "values"
fields:
- {label: Title, name: title, widget: string}
- {label: Image, name: image, widget: image}
- label: Values
name: values
widget: list
fields:
- {label: Heading, name: heading, widget: string}
- {label: Text, name: text, widget: text}
- {label: Image, name: imageUrl, widget: image}
30 changes: 16 additions & 14 deletions src/cms.html
Original file line number Diff line number Diff line change
@@ -1,14 +1,16 @@
<!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-js.netlify.com/v1/netlify-identity-widget.js"></script>
</head>
<body>
<script src="<%= htmlWebpackPlugin.publicPath %>/<%= htmlWebpackPlugin.files.js[1] %>"></script>
</body>
</html>
<!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-js.netlify.com/v1/netlify-identity-widget.js"></script>
<link rel="stylesheet" href="https://unpkg.com/@staticcms/app@^2.0.0/dist/main.css" />
<link rel="cms-config-url" type="text/yaml" href="/admin/config.yml" />
</head>
<body>
<script src="<%= htmlWebpackPlugin.publicPath %>/<%= htmlWebpackPlugin.files.js[1] %>"></script>
</body>
</html>
36 changes: 18 additions & 18 deletions src/js/cms.js
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
import CMS from "@staticcms/core";

// Import main site styles as a string to inject into the CMS preview pane
import styles from "!to-string-loader!css-loader!postcss-loader!sass-loader!../css/main.scss";

import HomePreview from "./cms-preview-templates/home";
import PostPreview from "./cms-preview-templates/post";
import ProductsPreview from "./cms-preview-templates/products";
import ValuesPreview from "./cms-preview-templates/values";
import ContactPreview from "./cms-preview-templates/contact";

CMS.registerPreviewStyle(styles, { raw: true });
CMS.registerPreviewTemplate("home", HomePreview);
CMS.registerPreviewTemplate("post", PostPreview);
CMS.registerPreviewTemplate("products", ProductsPreview);
CMS.registerPreviewTemplate("values", ValuesPreview);
CMS.registerPreviewTemplate("contact", ContactPreview);
CMS.init();
import CMS from "@staticcms/core";

// Import main site styles as a string to inject into the CMS preview pane
import styles from "!to-string-loader!css-loader!postcss-loader!sass-loader!../css/main.scss";

import HomePreview from "./cms-preview-templates/home";
import PostPreview from "./cms-preview-templates/post";
import ProductsPreview from "./cms-preview-templates/products";
import ValuesPreview from "./cms-preview-templates/values";
import ContactPreview from "./cms-preview-templates/contact";

CMS.registerPreviewStyle(styles, { raw: true });
CMS.registerPreviewTemplate("home", HomePreview);
CMS.registerPreviewTemplate("post", PostPreview);
CMS.registerPreviewTemplate("products", ProductsPreview);
CMS.registerPreviewTemplate("values", ValuesPreview);
CMS.registerPreviewTemplate("contact", ContactPreview);
CMS.init();
Loading

0 comments on commit 862d2a3

Please sign in to comment.