🎉 Start development

This commit is contained in:
2024-01-20 23:19:15 +08:00
commit c80003459e
46 changed files with 11644 additions and 0 deletions

1
tina/.gitignore vendored Normal file
View File

@ -0,0 +1 @@
__generated__

30
tina/collection/author.ts Normal file
View File

@ -0,0 +1,30 @@
import type { Collection } from "tinacms";
const Author: Collection = {
label: "Authors",
name: "author",
path: "content/authors",
format: "mdx",
fields: [
{
type: "string",
label: "Name",
name: "name",
isTitle: true,
required: true,
},
{
type: "image",
label: "Avatar",
name: "avatar",
},
{
type: "rich-text",
label: "Introduction",
name: "_body",
templates: [],
isBody: true,
},
],
};
export default Author;

51
tina/collection/event.ts Normal file
View File

@ -0,0 +1,51 @@
import type { Collection } from "tinacms";
const Event: Collection = {
label: "Events",
name: "event",
path: "content/events",
format: "mdx",
ui: {
router: ({ document }) => {
return `/events/${document._sys.filename}`;
},
},
fields: [
{
type: "string",
label: "Title",
name: "title",
isTitle: true,
required: true,
},
{
type: "image",
name: "heroImg",
label: "Hero Image",
},
{
type: "reference",
label: "Author",
name: "author",
collections: ["author"],
},
{
type: "datetime",
label: "Published Date",
name: "date",
ui: {
dateFormat: "MMMM DD YYYY",
timeFormat: "hh:mm A",
},
},
{
type: "rich-text",
label: "Body",
name: "_body",
templates: [],
isBody: true,
},
],
};
export default Event;

36
tina/collection/page.ts Normal file
View File

@ -0,0 +1,36 @@
import type { Collection } from "tinacms";
const Page: Collection = {
label: "Pages",
name: "page",
path: "content/pages",
format: "mdx",
ui: {
router: ({ document }) => {
if (document._sys.filename === "about") {
return `/about`;
}
return undefined;
},
},
fields: [
{
type: "string",
label: "Title",
name: "title",
description:
"The title of the page. This is used to display the title in the CMS",
isTitle: true,
required: true,
},
{
type: "rich-text",
label: "Body",
name: "_body",
templates: [],
isBody: true,
},
],
};
export default Page;

56
tina/collection/post.ts Normal file
View File

@ -0,0 +1,56 @@
import type { Collection } from "tinacms";
const Post: Collection = {
label: "Posts",
name: "post",
path: "content/posts",
format: "mdx",
ui: {
router: ({ document }) => {
return `/posts/${document._sys.filename}`;
},
},
fields: [
{
type: "string",
label: "Title",
name: "title",
isTitle: true,
required: true,
},
{
type: "image",
name: "heroImg",
label: "Hero Image",
},
{
type: "rich-text",
label: "Excerpt",
name: "excerpt",
},
{
type: "reference",
label: "Author",
name: "author",
collections: ["author"],
},
{
type: "datetime",
label: "Published Date",
name: "date",
ui: {
dateFormat: "MMMM DD YYYY",
timeFormat: "hh:mm A",
},
},
{
type: "rich-text",
label: "Body",
name: "_body",
templates: [],
isBody: true,
},
],
};
export default Post;

41
tina/config.ts Normal file
View File

@ -0,0 +1,41 @@
import { defineConfig } from "tinacms";
import Author from "./collection/author";
import Event from "./collection/event";
import Post from "./collection/post";
import Page from "./collection/page";
// Your hosting provider likely exposes this as an environment variable
const branch =
process.env.GITHUB_BRANCH ||
process.env.VERCEL_GIT_COMMIT_REF ||
process.env.HEAD ||
"main";
export default defineConfig({
branch,
// Get this from tina.io
clientId: process.env.NEXT_PUBLIC_TINA_CLIENT_ID,
// Get this from tina.io
token: process.env.TINA_TOKEN,
build: {
outputFolder: "admin",
publicFolder: "public",
},
media: {
tina: {
mediaRoot: "",
publicFolder: "public",
},
},
// See docs on content modeling for more info on how to setup new content models: https://tina.io/docs/schema/
schema: {
collections: [
Author,
Event,
Page,
Post,
],
},
});

1
tina/tina-lock.json Normal file

File diff suppressed because one or more lines are too long