-
Notifications
You must be signed in to change notification settings - Fork 0
/
_cms.ts
139 lines (132 loc) · 3.26 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
import lumeCMS from "lume/cms/mod.ts";
import GitHub from "lume/cms/storage/github.ts";
import { Octokit } from "npm:octokit";
const username = Deno.env.get("USERNAME1")!;
const password = Deno.env.get("PASSWORD1")!;
const cms = lumeCMS({
site: {
name: "eSolia Help CMS",
description: "Edit the content of the eSolia Help site",
url: "https://help.esolia.pro",
body: `
<p>This is a bilingual English and Japanese help and how-to site, but every page does not require a translation. When you do have a translation pair, just be sure the id is the same for both pages in the pair. You can open a page and duplicate it, as a starting point. </p>
`,
},
auth: {
method: "basic",
users: {
// foo: "bar",
[username]: password,
},
},
});
// Register GitHub storage
cms.storage(
"gh",
new GitHub({
client: new Octokit({ auth: Deno.env.get("GITHUB_TOKEN") }),
owner: "eSolia",
repo: "help.esolia.pro",
}),
);
// Register local storage
// cms.storage("gh", "/");
// Configure an upload folder
cms.upload("media", "gh:src/assets/img");
// Pages collection
cms.collection(
"pages",
"gh:/src/pages/*.md",
[
{
name: "title",
type: "text",
label: "Title of the Page",
description: "Visible in browser tab and page header",
attributes: {
required: true,
},
},
{
name: "description",
type: "textarea",
label: "Description for the Page",
description: "Visible in search engine results",
attributes: {
required: true,
},
},
{
name: "image",
type: "file",
uploads: "media",
attributes: {
accept: "image/*",
},
},
{
name: "tags",
type: "list",
label: "Tags",
description: "Tags to categorize the page",
init(field) {
field.options = ["PROdb", "M365", "Security", "Email", "Disaster", "セキュリティ", "メール", "災害"];
},
// init(field: any, { data }) {
// const site = data.site;
// const allTags = site.search.values("tags");
// field.options = allTags;
// },
},
"draft: checkbox",
// {
// name: "show_toc",
// type: "checkbox",
// label: "Show TOC on Page",
// description: "Checked causes the table of contents to show for the page",
// attributes: {
// required: false,
// value: true,
// },
// },
{
name: "order",
type: "number",
label: "Order",
description: "Order in which the page will appear in the menu",
attributes: {
required: true,
},
},
{
name: "lang",
type: "select",
label: "Language",
description: "Select the language of the page content",
attributes: {
required: true,
},
options: [
{
label: "日本語",
value: "ja"
},
{
label: "English",
value: "en"
},
],
},
{
name: "id",
type: "text",
label: "Unique ID for a Translation Pair",
description: "Must be the same for each language version of the same page",
attributes: {
required: true,
},
},
"content: markdown",
],
);
export default cms;