Using topic templates for categories

:bookmark: This guide explains how to use topic templates in categories and explores alternative methods for structuring content in Discourse.

:person_raising_hand: Required user level: Administrator

Topic templates are powerful tools for maintaining forum consistency and guiding new users. This guide will walk you through setting up category topic templates and explore alternative methods for structuring content in Discourse.

Summary

  • Learn how to set up category topic templates
  • Discover alternatives like pre-filled topic links and reply templates
  • Understand how to use topics as templates for canned replies

Setting up category topic templates

Category topic templates are useful when you want topics in a specific category to follow a consistent format. Here’s how to set them up:

  1. Navigate to the desired category
  2. Click the :wrench: (wrench) button
  3. Find “Topic Template” in the left menu
  4. Enter your desired template in the text area

For example, a “Movies” category might use this template:

I saw: [insert movie title]

I think it was worth: [how many stars] out of 4 stars

Review here:

:information_source: You can add hidden comments to the template using HTML comments: <!-- I'm an HTML comment -->.

Alternatives to category topic templates

If category topic templates don’t quite fit your needs, consider these alternatives:

Creating pre-filled topic links

You can create URLs that, when clicked, open a new topic with pre-filled information:

  1. Use this URL structure:
    https://discourse.example.com/new-topic?title=topic%20title&body=topic%20body&category=category/subcategory
  2. Modify the parameters as needed

For more details, read the guide on creating new topic links with pre-filled information.

Using reply templates

For topics that require structured replies, consider using the Reply Template theme component:

  1. Install the Reply Template theme component
  2. Set up your desired reply template

Example template:

[wrap=template key="template-name"]
Task list for $tomorrow
- [ ] task 1
- [ ] Clean the <!-- FILL IN ROOM NAME: --> _
[/wrap]

Creating template topics for canned replies

The Discourse Templates plugin allows you to use entire topics as templates for canned replies:

  1. Install the Discourse Templates plugin
  2. Create one or more categories to store your templates
  3. Add topics to these categories, with the first post serving as the template

Additional resources

Last edited by @hugh 2024-07-29T10:13:33Z

Check documentPerform check on document:
20 Likes

Maybe form-templates could be mentioned too.