Reply Template

:discourse2: Summary Reply Template will let you easily reuse part of a post in a reply or a new topic.
:eyeglasses: Preview Preview on Discourse Theme Creator
:hammer_and_wrench: Repository Link https://github.com/discourse/discourse-reply-template-component
:open_book: New to Discourse Themes? Beginner’s guide to using Discourse Themes

Install this theme component

Features

Reply Template will let you easily reuse part of a post in a reply or a new topic.

Usage

[wrap=template key="template-name"]
My reusable content

- [ ] task 1
- [ ] task 2
[/wrap]

Note that if a user is not logged in, clicking the button will display the login modal.

key is mandatory

Other options

  • action="create" this will make the button open a composer to create a new topic
  • action="create_pm" this will make the button open a composer to create a new PM
  • categoryId="2" only usable with action="create", will set the category of the opened composer
  • title="some title" only usable with create and create_pm, title of the topic/pm
  • recipients="a@example.com" only usable with create_pm, people this will be sent to
  • usernames=sam only usable with create_pm
  • label="My button text" The button text

Placeholders

You can have special keys in your template which will get replaced:

  • $week_start → date at the beginning of the week
  • $week_end → date at the end of the week
  • $prev_week_start → date at the start of previous week
  • $prev_week_end → date at the end of previous week
  • $today
  • $tomorrow
  • $username → username of current user
  • $name → name of current user

Note that this will be replaced by local dates.

Special placeholders are also interpolated in title

Tags list

tagsList=":heart:,foo,#bar" will show a least of checkboxes at the end of the template so people can tag their post easily.

Example

My todo list $week_end

  • task 1
  • task 2

Settings

Translation Default
discourse_reply_template_component Use template as reply
discourse_reply_template_component Use template as new topic
discourse_reply_template_component.use_template_create_pm Use template as new PM
discourse_reply_template_component.needs_key Each template needs a key attribute. eg: [wrap=template key="weekly_status"][/wrap]

:discourse2: Hosted by us? Theme components are available to use on our Standard, Business, and Enterprise plans.

Last edited by @cmdntd 2025-09-30T08:41:20Z

Last checked by @joo 2025-06-08T15:57:59Z

Check documentPerform check on document:
43 个赞

I was wondering can this be used in a specific category/sub?

Ie bug reporting form?

3 个赞

Yes :arrow_down:

E.g.
[wrap=template key="bug-report" action="create" categoryId="your-bug-category-id"]

9 个赞

Thank you will need to explore this more.

This is the best. Thank you!! I use this to create checklist templates that can be created anytime we’re doing a repetitive project. Before, our instructions would have been “copy and paste everything below” instead of having this very elegant button to create a topic for people.

5 个赞

Is there a plan to make this functionality accessible in the composer window? To me the most logical place being where things like Hide Details and Build Poll live.

3 个赞

I just updated the component, see OP for usage but a quick note:

  • placeholder dates are now replaced by local dates
  • you can now define a tagsList

8 个赞

Thank you for a great component!

It’s impossible to add a poll in the wrap. Can you add this functionality?

[wrap=template key="template-name"]

[poll type=regular results=on_vote chartType=bar]
# Who will join?
* 1
* 2
* 3
[/poll]

[/wrap]

I added more locales to your component and created a PR. Please, check.

1 个赞

How can i install this component?

In my opinion it’d be more helpful to have an example for the reply case (without action=create) because this is probably the reason, the majority is searching for since creating a topic is already possible via URL

My try:

  • ok
  • fail
2 个赞

Would it be possible to use a template to create a new personal message?

Also, when someone is not signed in, clicking on “Use template as reply” does not result in any action. Could you add functionality where if a user is not logged in, something happens to nudge them to log in or create a new account?

4 个赞

Great suggestion, it’s done, I updated the OP.

4 个赞

Is there a way to pre-populate the title of a new topic?

Is there a way to automatically add tags instead of having just the tag list?

4 个赞

No, but that’s reasonable feature request for sure. I’m kinda full ATM but making a note of this, thanks.

5 个赞

Is there any possible way to modify the stock reply button in a topic with such a template?
That would be a gamechanger for specific structured conversations in the forum. Especially for contests etc where users have to submit content in a structured manner.

1 个赞

Hi, sorry I don’t understand your request, can you be more specific please ?

Currently the user can access the reply template only via the button in the first post generated by the theme component.
What I would like to achieve is to enable the template for the stock reply buttons in the topic as well (reply button below the timeline and reply button below the last post)

Edit: One prolific use case is a topic where users can leave feedback like bug reports etc. If we could add per-topic post templates just like for per-category templates for new topics, that would lead to less incomplete reports and hence save our staff a lot of time.

5 个赞

您好,

我在安装此组件时遇到了一些问题。我是 Discourse 的新手,希望有人能确认我所采取的步骤是否正确。

我遵循了此处的指南 Installing a theme or theme component 来安装该组件。我已经将该组件包含在我们所有的主题中。

但是,当我创建一个新主题并包含

我的可重用内容

  • 任务 1
  • 任务 2

时,没有“使用模板作为回复”按钮。例如:

它只是显示了模板周围的包装器。我是否遗漏了某个步骤?我是否需要自定义代码中的某些内容?

另外,Discourse 提示主题在 CSS、HTML 或 YAML 中存在错误。我不确定这是否与按钮不显示有关?

感谢您的任何帮助。

明天会看一下

2 个赞

谢谢。我被告知这可能也是我们运行的 Discourse 版本的问题,但我们会再回来讨论这个问题。