Handlebars Helpers
If
Conditionally renders content based on truthy values during Handlebars substitution. Useful for optional message sections, prompts, payload fields, and template output.
Important
This helper can only be used to evaluate the truthiness of a variable, this means you cannot use any comparison operators like ==, ===, !=, !==, >, <, >=, <=.
You also can't do any arithmetic operations or any other expressions.
Use comparison helpers such as eq when you need to compare values inside an if, or if-eq when you want the comparison and conditional block combined.
You will get an error on the _create action when a new stub is created, if you try to use any of the above operations.
This an official Handlebars helper.
See the official Handlebars helper documentation for if
Example: Basic IF Conditional Rendering
This example shows how to conditionally render a block of text based on the value of a variable.
Example definition:
If the is_admin variable is true, the output will be:
If the is_admin variable is false, the output will be empty.
Example: IF-ELSE Conditional Rendering
This example shows how to conditionally render a block of text based on the value of a variable.
Example definition:
If the is_admin variable is true, the output will be:
If the is_admin variable is false, the output will be:
Example ERROR
!This cannot be done!
ERROR
This will throw an error on the _create action when a new stub is created.