为分类使用主题模板

:bookmark: 本指南介绍如何在分类中使用主题模板,并探讨在 Discourse 中构建内容的替代方法。

:person_raising_hand: 所需用户级别:管理员

主题模板是保持论坛一致性和指导新用户的强大工具。本指南将引导您完成设置分类主题模板的过程,并探讨在 Discourse 中构建内容的替代方法。

摘要

  • 了解如何设置分类主题模板
  • 发现预填主题链接和回复模板等替代方法
  • 了解如何将主题用作罐头回复的模板

设置分类主题模板

当您希望特定分类中的主题遵循一致格式时,分类主题模板非常有用。设置方法如下:

  1. 导航到所需分类
  2. 点击 :wrench:(扳手)按钮
  3. 在左侧菜单中找到“主题模板”(Topic Template)
  4. 在文本区域中输入您所需模板

例如,“电影”分类可能会使用此模板:

我看了:[插入电影名称]

我认为值:[星级] / 4 星
 
评论在此:

:information_source: 您可以使用 HTML 注释在模板中添加隐藏的注释:<!-- I'm an HTML comment -->

:bulb: “主题模板”选项卡还包含一个主题标题占位符(Topic Title Placeholder)字段。这允许您设置占位符文本,当用户在该分类中创建新主题时,该文本会出现在主题标题字段中,指导他们使用哪种标题格式。

分类主题模板的替代方法

如果分类主题模板不完全符合您的需求,请考虑以下替代方法:

创建预填主题链接

您可以创建 URL,当点击这些 URL 时,会打开一个带有预填信息的新主题:

  1. 使用此 URL 结构:
    https://discourse.example.com/new-topic?title=topic%20title&body=topic%20body&category=category/subcategory
  2. 根据需要修改参数

有关更多详细信息,请阅读有关创建带有预填信息的新主题链接的指南。

使用回复模板

对于需要结构化回复的主题,请考虑使用回复模板主题组件(Reply Template theme component):

  1. 安装回复模板主题组件
  2. 设置您想要的回复模板

示例模板:

[wrap=template key="template-name"]
$tomorrow 的任务清单
- [ ] 任务 1
- [ ] 清理 <!-- 填写房间名称: --> _
[/wrap]

为罐头回复创建模板主题

Discourse 模板插件允许您将整个主题用作罐头回复的模板:

  1. 安装 Discourse 模板插件
  2. 创建一个或多个分类来存储您的模板
  3. 在这些分类中添加主题,第一个帖子用作模板

附加资源

20 个赞
Is there a way to make an input form for structured data?
How to add information while user creates post
Is it possible to have a questionnaire topic?
How to optimize issue/support ticket like workflow?
Can I add new fields to a topic?
Replies with specified fields
Using Discourse as a personal Journal?
Custom Topic Fields
How to hide placeholder from message composer
Optimized interface for mass editing topic titles?
Feature request: duplicate posts
Building a practitioner directory or category in a community
Plugin to gather approvals / signatures on an initiative?
How to include the label/text on the post creation textbox?
Auto-Populating Category Topic Templates with Usernames
Does this platform not give users templates when creating posts?
Creating form templates
Reply Template
Custom topic fields per category or custom topic entry form per category?
How can I set up a reminder banner in the editor?
Structuring an active support community migrating from Facebook
Discourse/jobs?
Thoughts from the Elm community on Intentional Communication
Replace "+ New Topic" with "+ Create Event" option
Use URL to compose a new message, with `body` adding new lines
Alerts that react to the user
Can I customize the welcome message shown when creating a new topic based on the chosen tag or category?
Forms on Discourse
Are the tables on top of some posts markdown or a feature?
Custom post warning for categories
Sending a message upon post
Topic template is confusing on mobile
Topic template is confusing on mobile

也许也可以提及 #form-templates。

这个基本主题模板是否支持占位符来显示发帖人的用户名?类似于 discourse-templates 的功能。

1 个赞

你好,我为我的某个类别创建了一个模板,但在用户创建新主题时没有使用,为什么会这样?谢谢。

似乎该组件阻止了模板的显示:“主题模板占位符文本”

我已停用该组件,现在我的模板可以正常工作了。

2 个赞

我建议添加 topic-templates 标签。

1 个赞