Interpolation Keys for Customizing Text and System Email Templates

While Customizing text in Discourse or Customizing specific email templates you may have noticed that there are placeholder variables available in some templates. In Discourse we call these Interpolation Keys.

Example of Interpolation Keys for the Account Created email template:

These placeholders can be moved around within the template they belong to, but they are only available in that template and cannot be moved around to different templates, as they are all backed by server code that’s to the corresponding template.

However, there are some additional Interpolation Keys allowed in text and email templates that you can find listed here: ALLOWED_CUSTOM_INTERPOLATION_KEYS

You can use all system_messages.welcome_user keys in text and email template customizations as long as they have subject_template and text_body_template subkeys - Because all of them should be handled by the SystemMessage class which adds username, name, name_or_username as additional interpolation keys. See system_message.rb for the related Discourse code.

Last edited by @MarkDoerr 2024-06-13T17:02:26Z

Check documentPerform check on document:

That’s not correct. Currently that works only for system_messages.welcome_user, but we could extend it to all other keys. This is pr-welcome material.


Thanks for pointing that out, this has been updated in the guide.

1 Like