Context Tags
Last updated
Last updated
A context tag is a way of associating content in a template to the actual data values that will be present in the individual instances of that template. In other words, it is a placeholder or marker that is used to indicate where specific data values should be inserted when the template is instantiated or used to create a new document, page, notification, or other piece of content.
When creating a template, you can use context tags to define specific areas where dynamic data should be inserted when the template is used to create an instance. The dynamic data is retrieved from various sources e.g. form submissions, assessment task form data, user profile info, organization info, and more.
For example, a template for a business letter might include context tags for the recipient's name, address, and date, which can be replaced with actual data when the template is used to create a new letter.
It allows separating the structure of the data and the actual values of that data, so that the same template could be reused with different data values, creating different outputs.
In Onestop, context tags are used in document templates, notification templates, field labels, field help text, and more.
When in configuring a template in onestop, you will see a "Use Conext Tags" button
Click on the button
A popup of all available context tags will appear for you to use
The context tag popup has the different tag categories on the left and the tags for the currently selected category on the right as shown below
To add a context tag to your template, simply click on the tag you wish to use and it will be appended to your template.
When using the above context tags, Onestop will render the value in your target e.g. document, email etc. as a pre-rendered HTML value. If you want more control over how the value is rendered, you can opt-in to using the raw value of the field by appending __raw to the tag. This will expose the raw json value of the field entry and you can use the Django Templating Language in your template to render more complex UI logic e.g. for loops.