|Discourse Templates allows the creation of content templates for repeated use. The templates are stored as topics in a special category, where they can be edited and discussed as needed.
|How to install plugins in Discourse
This plugin is pretty much a new version of Discourse Canned Replies but it is more flexible and stores the templates in a different way.
This plugin uses one or more categories to store the templates for later use. The first post on each topic in these categories will be used as the template for the replies.
This approach provides a lot more functionality then it was available before with
discourse-canned-replies as each template will have edit history, can have associated tags, and the subsequent posts can be used to discuss the content of the template if needed.
Only visible topics will be used as templates, so topics unlisted and archived won’t be listed.
The plugin also leverages the categories security settings to check which users can use the templates. If the user can read the topics in the category then the option to “insert templates” in the composer will be available to use. The user will only be able to see the templates/topics in the categories that they have access
Multiple parent categories and/or sub-categories can be used to provide different sets of templates to be used to different groups of users and organize the templates.
The plugin also supports private templates. Private templates are private messages tagged as templates. These messages will be available as templates only to the author of the message.
Archived messages won’t be listed as templates.
You can find all your private templates at:
discourse templates enabled: Activates the plugin
discourse templates categories: Categories that used to store the templates. Each topic in theses categories and their sub-categories will be used as template and will be available to users that can see them in their original categories.
discourse templates enable private templates: Enables the use of private templates.
discourse templates groups allowed private templates: Groups of users allowed to use private templates.
Staff members are always allowed.
discourse templates private templates tags: Tags that will be used to mark private messages as templates.
After installing the plugin, you will need to create at least a category to store the templates.
Notice that every user that has access to read the topics in this category will be able to use the plugin functionality in the composer.
Pro-tip: The same settings to edit topics will be applied to “template” topics. If you want that anyone with write access in the category be able to edit the existing templates, you should activate
Make new topics wikis by defaulton the category settings.
After that, specify the category in the plugin settings.
That’s it. Now you only have to create some topics in the specified category and they will be available to use as templates.
If you want you can create sub-categories to better organize the templates or to provide different sets of replies to multiple groups of users.
To insert templates you must first open the reply composer and click the extras button, then select the option “Insert template”
Select the desired template, you can search by text or tags and click on the “paste” icon.
You can use Ctrl+Shift+I on PCs or ⌘+Shift+I on Macs to insert templates.
The keyboard shortcut will work inside any textarea on Discourse
Private templates will only work in instances with both private messages and tags enabled.
You need to configure the following settings Discourse settings in order for it to work:
tagging enabled: must be enabled.
enable personal messages: should be enabled if you want to make the feature available for non-staff users.
pm tags allowed for groups: you will need to allow the groups that will use private templates to tag private messages.
To use private templates you must first enable it in settings, assign the groups of users that can use it and assign at least a tag to mark the PMs as a template.
To create a personal template the users must:
- send an unencrypted personal message to themselves tagged with one of the tags configured in the plugin settings. Only to the author of the message will view it as a private template.
Private messages sent to other users also can be also be tagged but only the author of the message will be able to use it as a template.
The plugin supports the following variables on the templates:
All the above variables supports fallback text and will strip out the variable if fallback is not specified and the variable can’t be replaced.
Both title and body supports variable replacement.
reply_to_username is not available, the template will be:
There is a rake task to migrate the existing canned replies to templates:
This took only a few seconds to to run on Meta to migrate 47 canned replies so it should be safe to use unless you have a staggering amount of canned replies.
extend functionality to other places beyond the composer
allow using more than one parent category as template sources
- 2022-07-14T03:00:00Z: Added ability to use multiple parent categories as source for templates
- 2022-07-18T03:00:00Z: Private templates
- 2022-08-10T03:00:00Z: Global keyboard shortcut