forked from UllrAI/SaaS-Starter
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathkeystatic.config.ts
More file actions
64 lines (62 loc) · 1.83 KB
/
keystatic.config.ts
File metadata and controls
64 lines (62 loc) · 1.83 KB
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
import { config, fields, collection } from "@keystatic/core";
export const showAdminUI = process.env.NODE_ENV === "development";
import { APP_NAME } from "@/lib/config/constants";
export default config({
storage: {
// 仅在本地开发环境中可用管理面板
kind: "local",
},
ui: {
brand: { name: APP_NAME },
},
collections: {
authors: collection({
label: "Authors",
slugField: "name",
path: "content/authors/*",
format: { data: "json" },
schema: {
name: fields.slug({ name: { label: "Name" } }),
avatar: fields.image({
label: "Avatar",
directory: "public/avatars",
publicPath: "/avatars/",
}),
},
}),
posts: collection({
label: "Blog",
slugField: "title",
path: "content/blog/*",
format: { contentField: "content" },
schema: {
title: fields.slug({ name: { label: "Title" } }),
publishedDate: fields.date({ label: "Published Date" }),
author: fields.relationship({
label: "Author",
collection: "authors",
}),
excerpt: fields.text({
label: "Excerpt",
description: "A brief summary of the blog post (optional)",
multiline: true,
}),
tags: fields.array(fields.text({ label: "Tag" }), {
label: "Tags",
itemLabel: (props) => props.value || "Tag",
}),
featured: fields.checkbox({
label: "Featured Post",
description: "Mark this post as featured",
}),
heroImage: fields.image({
label: "Hero Image",
description: "Featured image for the blog post (optional)",
directory: "public/blog",
publicPath: "/blog/",
}),
content: fields.markdoc({ label: "Content" }),
},
}),
},
});