-
Notifications
You must be signed in to change notification settings - Fork 0
/
_cms.ts
176 lines (167 loc) · 4.23 KB
/
_cms.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
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
import lumeCMS from "lume/cms/mod.ts";
const username = Deno.env.get("USERNAME1")!;
const password = Deno.env.get("PASSWORD1")!;
const cms = lumeCMS({
site: {
name: "JAC Website CMS",
description: "Edit the content of the JAC site.",
url: "https://japanactivationcapital.com",
body: `
<p>This is the CMS for a the JAC site, including sections for uploading media, editing news and team bio pages.</p>
`,
},
auth: {
method: "basic",
users: {
// foo: "bar",
[username]: password,
},
},
log: {
filename: "cms_errors.log",
},
});
// Storage is local, so no need to specify?
// Configure an upload folder
cms.upload("media", "media");
// News pages collection
cms.collection(
"news",
"news/*.md",
[
{
name: "title",
type: "text",
label: "News Item Title",
description:
"As the news page’s metadata title, enter the title of the news item, in the same language as the content. Careful, this becomes the URL slug and filename, so get it right the first time, and it’s recommended to keep the length under 70 Japanese characters.",
attributes: {
required: true,
},
},
{
name: "description",
type: "textarea",
label: "News Item Description",
description:
"As the news page’s metadata description, enter a short description for the news post in the same language as the content, to be used by search engines and social media.",
attributes: {
required: true,
},
},
{
name: "lang",
type: "select",
label: "Language",
description: "Language of the news item.",
options: [
{
label: "日本語",
value: "ja",
},
{
label: "English",
value: "en",
},
],
attributes: {
required: true,
},
},
{
name: "id",
type: "text",
label: "ID to group Language Pairs",
description:
"This links the languages of a news item, so use e.g. 20231215A for both Japanese and English, then 20231215B, ...C, etc, for subsequent news items on that day.",
},
{
name: "tags",
type: "list",
label: "Tags",
description: "Enter the tag for the news item (News or Media).",
init(field) {
field.options = ["News", "Media"];
},
},
"draft: checkbox",
{
name: "date",
type: "date",
label: "Date",
description: "Date of the news item.",
attributes: {
required: true,
},
},
{
name: "img",
type: "file",
label: "Featured Image",
description:
"Upload the featured image for the news post (defaults to the logo). You can also opt to remove the image.",
attributes: {
accept: "image/*",
required: false,
default: "media/logo.png",
},
},
"content: markdown",
],
);
cms.document({
name: "Top Page",
description: "Edit the content of the top Japanese page",
store: "index.vto",
fields: [
"title: text",
"description: text",
{
name: "priority",
type: "number",
label: "Priority for sitemap",
description:
"1 is highest priority, 0 is lowest priority, and you can set decimal numbers in between like 0.9.",
attributes: {
required: false,
min: 0,
max: 1,
step: 0.1,
},
},
"content: markdown",
],
});
cms.document({
name: "About Page",
description: "Edit the content of the top English page",
store: "en/index.vto",
fields: [
"title: text",
"description: text",
{
name: "priority",
type: "number",
label: "Priority for sitemap",
description:
"1 is highest priority, 0 is lowest priority, and you can set decimal numbers in between like 0.9.",
attributes: {
required: false,
min: 0,
max: 1,
step: 0.1,
},
},
"content: markdown",
],
});
cms.document({
name: "ld-person",
description:
"Edit the content of the ld-person script for the person, which will appear in the head of the about page",
store: "_includes/templates/ld-person.vto",
fields: [
"content: markdown",
],
});
export default cms;