# 开发 Discourse 插件 - 第 3 部分 - 添加自定义站点设置

**URL:** <https://meta.discourse.org/t/developing-discourse-plugins-part-3-add-custom-site-settings/31115>\
**Category:** Developer Guides\
**Tags:** plugin-guides, tutorial\
**Created:** [2015年七月16日 15:35 UTC](https://meta.discourse.org/t/developing-discourse-plugins-part-3-add-custom-site-settings/31115 "2015-07-16T15:35:33Z")\
**Posts on this page:** 1\
**Showing post:** 46

<div class="post-metadata">

**Author:** ![Arkshine](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/arkshine/32/298682_2.png) [@Arkshine](https://meta.discourse.org/u/Arkshine)\
**Post date:** [2025年三月15日 23:08 UTC](https://meta.discourse.org/t/developing-discourse-plugins-part-3-add-custom-site-settings/31115/46 "2025-03-15T23:08:09Z")

</div>

插件和主题组件类型之间存在差异。

我尝试制作了一个表格（预计会有小的错误或分组）

| 类别 | 功能 | 插件语法 | TC 语法 |
| --- | --- | --- | --- |
| **基本类型** | 字符串 | `type: string`  
`min: ..`  
`max: ..`  
`regex: ..`  
`secret: true/false`  
global  
`validator: 类名` | `type: string`  
`min: ..`  
`max: ..`  
-  
-  
-  
- |
| | 多行文本 | `type: string`  
`textarea: true` | `type: string`  
`textarea: true` |
| | 整数 | `type: integer`  
`min: ..`  
`max: ..` | `type: integer`  
`min: ..`  
`max: ..` |
| | 浮点数 | `type: float`  
`min: ..`  
`max: ..` | `type: float`  
`min: ..`  
`max: ..` |
| | 布尔值 | `type: bool` | `type: bool` |
| | 时间 | `type: time` | - |
| | Null | `type: null` | - |
| **选择类型** | 枚举（下拉菜单） | `type: enum`  
`choices: [option1, option2]`  
`enum: ..` | `type: enum`  
`choices: [option1, option2]` |
| | 类别 | `type: category` | - |
| | 颜色 | `type: color` | - |
| | 组 | `type: group` | - |
| | 电子邮件 | `type: email` | - |
| | 用户名 | `type: username` | - |
| **列表类型** | 通用列表 | `type: list`  
`allow_any: true/false` | `type: list` |
| | 简单/紧凑列表 | `type: simple_list`  
或  
`type: list`  
`list_type: compact`  
`list_type: simple` | `type: list`  
`list_type: compact`  
`list_type: simple` |
| | 类别列表 | `type: category_list` | `type: list`  
`list_type: category` |
| | 组列表 | `type: group_list` | `type: list`  
`list_type: group` |
| | 标签列表 | `type: tag_list` | `type: list`  
`list_type: tag` |
| | 标签组列表 | `type: tag_group_list` | - |
| | URL 列表 | `type: url_list` | - |
| | 主机列表 | `type: host_list` | - |
| | 值列表 | `type: value_list` | - |
| | Emoji 列表 | `type: emoji_list` | - |
| **文件类型** | 上传 | `type: upload` | `type: upload` |
| | 上传图片列表 | `type: uploaded_image_list` | - |
| | 文件大小限制 | `type: file_size_restriction`  
`min: ..`  
`max: ..` | - |
| **特殊类型** | HTML（已弃用） | `type: html_deprecated` | - |
| | JSON 对象 | _已弃用_ | _已弃用_ |
| | 对象 | - | `type: objects` |

---

_[View the full topic](https://meta.discourse.org/t/developing-discourse-plugins-part-3-add-custom-site-settings/31115)._
