Add initial TinaCMS
This commit is contained in:
2
.gitignore
vendored
2
.gitignore
vendored
@@ -16,3 +16,5 @@ pnpm-debug.log*
|
||||
|
||||
# macOS-specific files
|
||||
.DS_Store
|
||||
|
||||
node_modules
|
||||
17967
package-lock.json
generated
17967
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
@@ -15,5 +15,9 @@
|
||||
"astro": "^2.6.6",
|
||||
"prettier": "^2.8.4",
|
||||
"prettier-plugin-astro": "^0.8.0"
|
||||
},
|
||||
"dependencies": {
|
||||
"@tinacms/cli": "^1.5.30",
|
||||
"tinacms": "^1.5.21"
|
||||
}
|
||||
}
|
||||
|
||||
2
public/admin/.gitignore
vendored
Normal file
2
public/admin/.gitignore
vendored
Normal file
@@ -0,0 +1,2 @@
|
||||
index.html
|
||||
assets/
|
||||
@@ -5,9 +5,9 @@ export default function getTags(posts) {
|
||||
const postTags = post.frontmatter.tags;
|
||||
let allTags = [];
|
||||
|
||||
if (postTags.length > 0) {
|
||||
if (postTags?.length > 0) {
|
||||
postTags.forEach((tag) => {
|
||||
if (allTags.indexOf(tag) === -1) {
|
||||
if (allTags?.indexOf(tag) === -1) {
|
||||
allTags.push(tag);
|
||||
}
|
||||
});
|
||||
|
||||
1
tina/.gitignore
vendored
Normal file
1
tina/.gitignore
vendored
Normal file
@@ -0,0 +1 @@
|
||||
__generated__
|
||||
82
tina/config.js
Normal file
82
tina/config.js
Normal 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
1
tina/tina-lock.json
Normal file
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user