Add initial TinaCMS

This commit is contained in:
Cassidy Williams
2023-10-20 16:47:08 -05:00
parent 4b7488fcaf
commit 875fa394b2
8 changed files with 17322 additions and 741 deletions

2
.gitignore vendored
View File

@@ -16,3 +16,5 @@ pnpm-debug.log*
# macOS-specific files # macOS-specific files
.DS_Store .DS_Store
node_modules

17967
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@@ -15,5 +15,9 @@
"astro": "^2.6.6", "astro": "^2.6.6",
"prettier": "^2.8.4", "prettier": "^2.8.4",
"prettier-plugin-astro": "^0.8.0" "prettier-plugin-astro": "^0.8.0"
},
"dependencies": {
"@tinacms/cli": "^1.5.30",
"tinacms": "^1.5.21"
} }
} }

2
public/admin/.gitignore vendored Normal file
View File

@@ -0,0 +1,2 @@
index.html
assets/

View File

@@ -5,9 +5,9 @@ export default function getTags(posts) {
const postTags = post.frontmatter.tags; const postTags = post.frontmatter.tags;
let allTags = []; let allTags = [];
if (postTags.length > 0) { if (postTags?.length > 0) {
postTags.forEach((tag) => { postTags.forEach((tag) => {
if (allTags.indexOf(tag) === -1) { if (allTags?.indexOf(tag) === -1) {
allTags.push(tag); allTags.push(tag);
} }
}); });

1
tina/.gitignore vendored Normal file
View File

@@ -0,0 +1 @@
__generated__

82
tina/config.js Normal file
View File

@@ -0,0 +1,82 @@
import { defineConfig } from "tinacms";
// Your hosting provider likely exposes this as an environment variable
const branch = process.env.HEAD || "main";
export default defineConfig({
branch,
clientId: null, // Get this from tina.io
token: null, // Get this from tina.io
build: {
outputFolder: "admin",
publicFolder: "public",
},
media: {
tina: {
mediaRoot: "",
publicFolder: "public",
},
},
schema: {
collections: [
{
name: "post",
label: "Posts",
path: "src/posts",
defaultItem: () => ({
title: "New Post",
layout: "../layouts/BlogPost.astro",
added: new Date(),
tags: [],
}),
fields: [
{
name: "layout",
label: "Layout",
type: "string",
required: true,
},
{
name: "title",
label: "Title",
type: "string",
isTitle: true,
required: true,
},
{
label: "Slug",
name: "slug",
type: "string",
required: true,
},
{
label: "Description",
name: "description",
type: "string",
required: true,
},
{
label: "Tags",
name: "tags",
type: "string",
list: true,
},
{
label: "Added",
name: "added",
type: "datetime",
dateFormat: "MMM DD YYYY",
required: true,
},
{
type: "rich-text",
name: "body",
label: "Body",
isBody: true,
},
],
},
],
},
});

1
tina/tina-lock.json Normal file

File diff suppressed because one or more lines are too long