-
-
Notifications
You must be signed in to change notification settings - Fork 5
/
config.yml
356 lines (340 loc) · 14.1 KB
/
config.yml
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
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
# Netlify CMS config
backend:
# there are 2 backend options: netlify identify, github
# Use netlify identity as backend, ideal for multiuser sites
# https://www.netlifycms.org/docs/git-gateway-backend/
# name: git-gateway
# branch: main
# use github as backend, can login with github account, but require push access to the repo.
# ideal for personal or small group sites
# https://www.netlifycms.org/docs/github-backend/
name: github
repo: <github_user>/<repo> # e.g.: huangyuzhang/Fizzy-Jam
branch: main
# uncomment to use local backend for testing (/admin)
# then run `npm run local` instead
# local_backend: true
media_folder: "src/static/img"
public_folder: "/static/img"
# publish_mode: editorial_workflow
display_url: /
locale: "en"
show_preview_links: true
slug:
encoding: "ascii"
clean_accents: true
sanitize_replacement: "_"
# A list of collections the CMS should be able to edit
# doc: https://www.netlifycms.org/docs/collection-types/
# sample: https://github.com/netlify/netlify-cms/blob/master/dev-test/config.yml
collections:
# Posts (folder collection)
- label: "Posts" # Used in the admin UI
label_singular: "post" # Used in the admin UI
name: "post" # Used in routes, ie.: /admin/collections/:slug/edit
folder: "src/collections/post"
# https://www.netlifycms.org/docs/configuration-options/#slug-type
slug: "{{fields.slug}}" # {{slug}} will use the title-generated slug as file name
# preview_path: "post/{{fields.slug}}" # work for editorial workflow
summary: "{{title}} ({{date}}) | By: {{authors[0]}} | Main Tag: {{tags[0]}}" # CMS collection list UI
create: true
editor:
preview: false
sortable_fields: ["commit_date", "title", "author", "date"]
# Used in the UI, for filter
view_filters:
- label: Posts With Index
field: title
pattern: "This is post #"
- label: Posts Without Index
field: title
pattern: front matter post
- label: "Posts published in 2020"
field: date
pattern: "2020"
- label: Drafts
field: draft
pattern: true
view_groups:
- label: Year
field: date
# groups items based on the value matched by the pattern
pattern: \d{4}
- label: Drafts
field: draft
fields:
- { label: "Title", name: "title", widget: "string" }
- label: "Slug"
name: "slug"
widget: "string"
pattern: ["^[a-z0-9]+(?:[._-][a-z0-9]+)*$","A slug can have no spaces or special characters"]
hint: >-
The post URL (do not include folder or file extension, change slug may cause link break!)
# https://www.netlifycms.org/docs/widgets/#datetime
- label: "Date"
name: "date"
widget: "datetime"
# default: "" # comment it to get the current datetime
format: "YYYY-MM-DD" # Used in front-end and readableDate function
date_format: "YYYY-MM-DD" # e.g. 2021.12.24
time_format: false # e.g. "HH:mm" -> 21:07
picker_utc: false
# Relation -> Authors
- label: "Authors"
name: "authors"
widget: "relation"
collection: "author"
value_field: "slug"
search_fields: ["name", "website", "slug", "description"]
display_fields: ["{{name}}({{fields.slug}})"]
multiple: true
# Relation -> Tag
- label: "Tags"
name: "tags"
widget: "relation"
collection: "tag"
value_field: "slug"
search_fields: ["name","slug","description"]
display_fields: ["name"]
options_length: 10
required: false
multiple: true
- label: "Featured Image"
name: "image"
widget: "image"
required: false
- { label: "Featured Post", name: "isFeatured", widget: "boolean", required: false, default: false }
- { label: "Table of Content", name: "toc", widget: "boolean", default: true, required: false }
- { label: "Description", name: "description", widget: "text", hint: "Short Summary", required: false } # text: multi-line text block
- { label: "Content", name: "body", widget: "markdown", modes: ["raw","rich_text"] }
# Pages (folder collection)
- label: "Pages"
label_singular: "page"
name: "page"
folder: "src/collections/page"
slug: "{{path}}"
# preview_path: "post/{{fields.slug}}" # work for editorial workflow
description: >-
Use pages to customize post listing page, about page, etc.
summary: "{{title}} | {{path}}"
create: true
editor:
preview: false
sortable_fields: ["commit_date", "title", "author", "date"]
fields:
- { label: "Title", name: "title", widget: "string" }
- label: "Path"
name: "path"
widget: "string"
pattern: ["^[a-z0-9]+(?:[._-][a-z0-9]+)*$","A slug can have no spaces or special characters"]
hint: >-
Used in permalink "/{{ path }}/ and navigation url, e.g.: "about".
- label: "Date"
name: "date"
widget: "datetime"
# default: "" # comment it to get the current datetime
format: "YYYY-MM-DD" # Used in front-end and readableDate function
date_format: "YYYY-MM-DD" # e.g. 2021.12.24
time_format: false # e.g. "HH:mm" -> 21:07
picker_utc: false
- label: "Featured Image"
name: "image"
widget: "image"
required: false
tagname: ""
- label: "Layout"
name: "layout"
widget: "select"
options: ["single-page", "list-post", "archive", "list-tag", "list-author"]
default: "single-page"
hint: "Layouts are stored in `src/_includes/layouts/`."
- { label: "Description", name: "description", widget: "text", hint: "Used in SEO Description", required: false } # text: multi-line text block
- { label: "Table of Content", name: "toc", widget: "boolean", default: false, required: false }
- { label: "Content", name: "body", widget: "markdown", modes: ["raw","rich_text"], required: false }
# Tags (folder collection)
- label: "Tags"
label_singular: "tag"
name: "tag"
folder: "src/collections/tag"
description: >-
Change tag slug may cause link break, make sure to change the file name in `src/collections/tag` as well.
Delete a tag will NOT remove this tag in posts' md files, manual modification required.
create: true
slug: "{{fields.slug}}"
summary: "{{name}} ({{fields.slug}})"
editor:
preview: false
fields:
- { label: "Name", name: "name", widget: "string" }
- label: "Slug"
name: "slug"
widget: "string"
required: true
pattern: ["^[a-z0-9]+(?:[._-][a-z0-9]+)*$","A slug can have no spaces or special characters"]
hint: >-
Change slug requires manual modification on posts' tag list.
- label: "SEO Title"
name: "seoTitle"
widget: "string"
required: false
- label: "Featured Image"
name: "image"
widget: "image"
required: false
tagname: ""
- { label: "Description", name: "description", widget: "text", required: false} # text: multi-line text block
# Authors (folder collection)
- label: "Authors"
label_singular: "author"
name: "author"
folder: "src/collections/author/"
description: >-
Change slug may cause link break, make sure to change the file name in `src/collections/author` as well.
Delete an author will NOT remove this author in posts' md files.
create: true
slug: "{{fields.slug}}"
summary: "{{name}} ({{fields.slug}}) - {{more.website}}"
editor:
preview: false
fields:
- { label: "Name", name: "name", widget: "string", hint: "First and Last" }
- label: "Slug"
name: "slug"
widget: "string"
required: true
pattern: ["^[a-z0-9]+(?:[._-][a-z0-9]+)*$","A slug can have no spaces or special characters"]
hint: >-
The author URL (do not include folder or file extension)
- { label: "Avatar", name: "avatar", widget: "image", hint: "Squared image recommended.", allow_multiple: false, required: false}
- { label: "Background Image", name: "bgImage", widget: "image", allow_multiple: false, required: false}
- { label: "Bio", name: "bio", widget: "markdown", required: false}
- label: "More"
name: "more"
widget: "object"
collapsed: true
fields:
- {label: "Website", name: "website", widget: "string", hint: "Start with https://", required: false}
- {label: "GitHub", name: "github", widget: "string", required: false}
- {label: "Twitter", name: "twitter", widget: "string", required: false}
- {label: "Location", name: "location", widget: "string", required: false}
# Settings (file collection)
- label: "Settings"
name: "settings"
description: "Manage navigation, authors, and site-level settings."
editor:
preview: false
delete: false # Prevent users from deleting documents in this collection
files:
- label: "Navigation"
name: "navigation"
file: "src/_data/navigation.yaml"
fields:
- label: "Nav Items"
name: "navItems"
widget: "list"
# allow_add: false
summary: "{{fields.text}}: {{fields.url}}"
collapsed: true
fields:
- { label: Title, name: text, widget: string }
- { label: URL, name: url, widget: string }
- label: "Footer Items"
name: "footerItems"
widget: "list"
summary: "{{fields.text}}: {{fields.url}}"
allow_add: false
collapsed: true
fields:
- { label: Title, name: text, widget: string }
- { label: URL, name: url, widget: string }
# - label: "Quick Links"
# name: "links"
# file: "src/_data/quicklinks.yaml"
# fields:
# - label: "Link Items"
# name: "links"
# widget: "list"
# collapsed: false
# fields:
# - { label: Title, name: title, widget: string }
# - { label: URL, name: url, widget: string }
# - { label: Description, name: desc, widget: string }
- label: "Settings"
name: "settings"
file: "src/_data/settings.yaml"
widget: "object"
fields:
# Meta Info
- label: "Site Meta"
name: "meta"
allow_add: false
widget: "object"
summary: "Site Name: {{fields.name}} {{fields.url}}"
delete: false
collapsed: true
fields:
- { label: Site Name, name: name, widget: string, required: true }
- { label: Site URL, name: url, widget: string, required: false, hint: 'default: /'}
- { label: LOGO, name: logo, widget: image, allow_multiple: false, required: false}
- { label: Icon, name: icon, widget: image, allow_multiple: false, required: false}
- { label: Description, name: description, widget: markdown, hint: 'Support markdown', required: false}
- { label: Footer Info, name: footerInfo, widget: markdown, hint: 'Support markdown', required: false}
# Post Listing Settings
- label: "Post Listing"
name: "post"
allow_add: false
widget: "object"
# summary: "{{fields.name}} - {{fields.url}}"
delete: false
collapsed: true
fields:
- { label: "Show Featured Image", name: "showFeatureImage", widget: "boolean", required: false, default: true }
- { label: "Feature Text", name: "featureText", widget: "string", hint: "default: featured", required: false, default: "featured" }
# SEO
- label: "SEO Settings"
name: "seo"
allow_add: false
widget: "object"
summary: "SEO title: {{fields.title}} | Keywords: {{fields.keywords}}"
delete: false
collapsed: true
fields:
- { label: "Title", name: "title", widget: "string", required: false }
- { label: "Keywords", name: "keywords", widget: "string", required: false }
# Appearance
# - label: "Appearance"
# name: "appearance"
# allow_add: false
# widget: "object"
# summary: "Main Color: {{fields.mainColor}}"
# delete: false
# collapsed: true
# fields:
# - { label: "Main Color", name: "mainColor", widget: "string", default: "#FB3B3B", required: false }
# # - { label: "Link Hover Color", name: "linkHoverColor", widget: "string", default: "#FF7A7A", required: false }
# Components
- label: "Components"
name: "component"
allow_add: false
widget: "object"
summary: "Author Box: {{fields.authorBox}} | Code Line Numbers: {{fields.codeLineNumbers}}"
delete: false
collapsed: true
fields:
- { label: "Navbar Search", name: "navSearch", widget: "boolean", default: true, required: false }
- { label: "Author Box", name: "authorBox", widget: "boolean", default: true, required: false }
- { label: "Code Line Numbers", name: "codeLineNumbers", widget: "boolean", default: true, required: false }
# - { label: "Link Hover Color", name: "linkHoverColor", widget: "string", default: "#FF7A7A", required: false }
# - label: "Authors"
# name: "authors"
# file: "src/_data/authors.yaml"
# fields:
# - name: authors
# label: Authors
# widget: list
# collapsed: false
# fields:
# - { label: "Name", name: "name", widget: "string", hint: "First and Last" }
# - { label: "Website", name: "website", widget: "string", hint: "Start with https://", required: false}
# - { label: "Avatar", name: "avatar", widget: "image", allow_multiple: false, required: false}
# - { label: "Description", name: "description", widget: "markdown", required: false}