settings_schema.json
Baklib
发布于:2024-07-07
文件内容
[
{
"name": "theme_info",
"theme_name": "daisy_wiki",
"theme_label": "t:theme_label",
"theme_version": "1.0.0",
"theme_scope": "wiki",
"theme_author": "Baklib",
"theme_description": "t:theme_description",
"theme_documentation_url": "https://help.baklib.cn/themes/daisy-wiki",
"theme_support_url": "https://help.baklib.cn/themes/daisy-wiki/settings",
"theme_thumb_url": "images/theme/thumb.png",
"theme_preview_images": [
"images/theme/index.png",
"images/theme/index-documentation.png",
"images/theme/index-portal.png",
"images/theme/page-channel.png",
"images/theme/page.png"
],
"theme_languages": [
{
"name": "中文简体",
"value": "zh-CN"
},
{
"name": "English",
"value": "en-US"
},
{
"name": "Germany",
"value": "de"
},
{
"name": "France",
"value": "fr"
}
],
"recommendations": {
"color_schemas": {
"fashion": {
"name": "时尚",
"colors": {
"--theme-color-primary": "#0d9488",
"--theme-color-secondary": "#ea580c",
"--theme-color-accent": "#AAAAAA",
"--theme-color-info": "#2196F3",
"--theme-color-success": "#4CAF50",
"--theme-color-warning": "#FFC107"
}
},
"old_school": {
"name": "复古",
"colors": {
"--theme-color-primary": "#9C27B0",
"--theme-color-secondary": "#673AB7",
"--theme-color-accent": "#AAAAAA",
"--theme-color-info": "#418CC8",
"--theme-color-success": "#29B52F",
"--theme-color-warning": "#FFC107"
}
}
}
}
},
{
"name": "t:settings_schema.generic.name",
"settings": [
{
"id": "is_allow_published_at",
"type": "checkbox",
"label": "文章内是否展示发布日期",
"default": true
},
{
"id": "is_allow_author",
"type": "checkbox",
"label": "文章内是否展示作者",
"default": true
}
]
},
{
"name": "t:settings_schema.generic.head_title",
"settings": [
{
"id": "head_html",
"type": "html",
"label": "t:settings_schema.generic.settings.head_html.label",
"info": "t:settings_schema.generic.settings.head_html.info",
"rows": 10,
"placeholder": "t:settings_schema.generic.settings.head_html.placeholder"
}
]
}
]
文件说明
文件内容为 JSON 格式,存储多个配置数组,每个配置必须包含 name
属性,表示配置的类型。
配置 name 为 "theme_info" 表示主题模版信息
theme_info 为特殊配置,每个 settings_schema.json 必须有且唯一存在。支持的属性如下:
属性名称 | 必填 | 类型 | 说明 |
---|---|---|---|
name | 是 | 字符串 | 此属性的值必须是 |
theme_name | 是 | 字符串 | 主题模版的名称标识。只允许字母、数字、下划线的组合,如: help_center |
theme_label | 否 | 字符串 | 主题模版的显示名称,如:帮助中心。 |
theme_version | 是 | 字符串 | 主题模版的版本号,格式遵循 |
theme_scope | 是 | 字符串 | 主题模板的类型。只允许填写: |
theme_author | 是 | 字符串 | 模版开发者 |
theme_description | 是 | 字符串 | 描述 |
theme_documentation_url | 否 | 字符串 | 文档地址 |
theme_support_url | 否 | 字符串 | 技术支持地址 |
theme_thumb_url | 是 | 字符串 | 缩略图地址 |
theme_preview_images | 是 | 字符串数组 | 预览图,数组 |
theme_languages | 否 | 字符串数组 | 多语言支持,填写数组,如 |
color_schemas | 否 | 哈希值 | 默认主题颜色配置 |
配置 name 为其它值表示站点配置项
属性名称 | 必填 | 类型 | 说明 |
---|---|---|---|
name | 是 | 字符串 | 此属性的值必填,不能是 |
settings | 是 | 哈希数组 | 在此定义站点的动态配置项,会展示在站点管理后台。模板代码中可通过 |
settings[x].id | 是 | 字符串 | 配置项的标识,如 |
settings[x].type | 是 | 字符串 | 配置项的类型,支持的配置类型参考下表“Setting支持的类型” |
settings[x].label | 是 | 字符串 | 配置项的显示名称 |
settings[x].info | 否 | 字符串 | 配置项的描述信息 |
settings[x].default | 否 | ||
settings[x].placeholder | 否 | 输入框的提示文字 |
附录
多语言支持名单
# 中文
'zh-CN' => '中国大陆简体'
'zh-TW' => '台湾繁体'
'zh-HK' => '香港繁体'
'zh-MO' => '澳门繁体'
'zh-SG' => '新加坡简体'
# 英语
'en' => '通用英语'
'en-US' => '英语 (美国)'
'en-GB' => '英语 (英国)'
'en-AU' => '英语 (澳大利亚)'
'en-CA' => '英语 (加拿大)'
'en-NZ' => '英语 (新西兰)'
'en-IE' => '英语 (爱尔兰)'
# 葡萄牙语
'pt' => '通用葡萄牙语'
'pt-BR' => '葡萄牙语 (巴西)'
'pt-PT' => '葡萄牙语 (葡萄牙)'
# 西班牙语
'es' => '通用西班牙语'
'es-ES' => '西班牙语 (西班牙)'
'es-MX' => '西班牙语 (墨西哥)'
'es-AR' => '西班牙语 (阿根廷)'
# 法语
'fr' => '通用法语'
'fr-FR' => '法语 (法国)'
'fr-CA' => '法语 (加拿大)'
'fr-BE' => '法语 (比利时)'
'fr-CH' => '法语 (瑞士)'
# 德语
'de' => '通用德语'
'de-DE' => '德语 (德国)'
'de-AT' => '德语 (奥地利)'
'de-CH' => '德语 (瑞士)'
# 其他主要语言
'ja' => '日语'
'ko' => '韩语'
'vi' => '越南语'
'th' => '泰语'
'id' => '印尼语'
'ms' => '马来语'
'ar' => '阿拉伯语'
'hi' => '印地语'
'bn' => '孟加拉语'
'ru' => '俄语'
'tr' => '土耳其语'
Setting支持的类型
类型 | 名称 |
header | 段落标题 |
paragraph | 段落描述 |
text | 单行文字输入框 |
number | 数字输入框 |
range | 数字范围 |
textarea | 多行文字输入框 |
richtext | 富文本输入框 |
html | HTML 源代码输入框 |
liquid | Liquid 源代码输入框 |
link | 链接输入框 |
checkbox | 复选框 |
radio | 单选项 |
select | 下拉选择框 |
color | 颜色选择器 |
color_background | 背景颜色选择器 |
date | 日期选择器 |
font_picker | 字体选择器 |
image_picker | 图片选择器 |
video_picker | 视频选择器 |
type 值 | 类型 | 默认值 | 说明 |
checkbox | True/False | false | |
color_background | 颜色值 | 背景颜色选择器,可以生成渐变色。颜色值在模板中的使用方法:
| |