Conditionals
Show or hide content in your templates
Conditionals in templates allow for the inclusion or exclusion of content based on certain conditions.
If
You can use {{if Condition}}
and {{endif}}
to show or hide the content in between, depending on whether Condition
is true or not.
For example, a template:
Please read before proceeding.
{{if showDisclaimer}}
Information provided is for educational purposes only and should not be considered as professional advice.
{{endif}}
Use at your own discretion.
With the data value:
Will return the document:
Please read before proceeding.
Information provided is for educational purposes only and should not be considered as professional advice.
Use at your own discretion.
But with the data value:
Will return the document:
Please read before proceeding.
Use at your own discretion.
If-Else
You can use {{if Condition}}
, {{else}}
, and {{endif}}
to conditionally display content based on whether Condition
is true or false.”
For example, a template:
{{if mediation}}
Any dispute shall be resolved by mediation, with each party bearing its own costs.
{{else}}
Any dispute shall be settled by arbitration, and the arbitrator’s decision is final.
{{endif}}
With data:
Will return the document:
Any dispute shall be resolved by mediation, with each party bearing its own costs.
But with data:
Will return the document:
Any dispute shall be settled by arbitration, and the arbitrator’s decision is final.
Was this page helpful?