-
Notifications
You must be signed in to change notification settings - Fork 26k
/
schema.ts
105 lines (101 loc) · 2.4 KB
/
schema.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
import { defineSchema, defineConfig } from 'tinacms'
export default defineSchema({
collections: [
{
label: 'Blog Posts',
name: 'posts',
path: '_posts',
fields: [
{
type: 'string',
label: 'Title',
name: 'title',
},
{
type: 'string',
label: 'Excerpt',
name: 'excerpt',
},
{
type: 'string',
label: 'Cover Image',
name: 'coverImage',
},
{
type: 'string',
label: 'Date',
name: 'date',
},
{
type: 'object',
label: 'author',
name: 'author',
fields: [
{
type: 'string',
label: 'Name',
name: 'name',
},
{
type: 'string',
label: 'Picture',
name: 'picture',
},
],
},
{
type: 'object',
label: 'OG Image',
name: 'ogImage',
fields: [
{
type: 'string',
label: 'Url',
name: 'url',
},
],
},
{
type: 'string',
label: 'Blog Post Body',
name: 'body',
isBody: true,
ui: {
component: 'textarea',
},
},
],
},
],
})
// Your tina config
// ==============
const branch = 'main'
// When working locally, hit our local filesystem.
// On a Vercel deployment, hit the Tina Cloud API
const apiURL =
process.env.NODE_ENV == 'development'
? 'http://localhost:4001/graphql'
: `https://content.tinajs.io/content/${process.env.NEXT_PUBLIC_TINA_CLIENT_ID}/github/${branch}`
export const tinaConfig = defineConfig({
apiURL,
cmsCallback: (cms) => {
// add your CMS callback code here (if you want)
// The Route Mapper
/**
* 1. Import `tinacms` and `RouteMappingPlugin`
**/
import('tinacms').then(({ RouteMappingPlugin }) => {
/**
* 2. Define the `RouteMappingPlugin` see https://tina.io/docs/tinacms-context/#the-routemappingplugin for more details
**/
const RouteMapping = new RouteMappingPlugin((collection, document) => {
return undefined
})
/**
* 3. Add the `RouteMappingPlugin` to the `cms`.
**/
cms.plugins.add(RouteMapping)
})
},
})