Template Conditional Helpers
Conditional helpers allow users to specify conditions for rendering part/section of a template. These helpers add additional truth logic to if
and unless
statements.
equal
Check if something is equal to
{{#if (equal model.Class "Audio")}}
<!--displayed when class is audio -->
{{/if}}
not-equal
Check if something is not-equal to
{{#if (not-equal model.Class "Audio")}}
<!--displayed when class is anything but audio -->
{{/if}}
not
Checks if something is not true or does not exist.
{{#if (not model.Invalid)}}
<!--displayed when entry is not invalid-->
{{/if}}
and
Similar to if (a && b), returns true when both a, b are true.
{{#if (and model.Author model.Editor)}}
<!--displayed when entry has both Author and Editor-->
{{/if}}
or
Similar to if (a || b), return true when either of a,b holds true
{{#if (or model.Author model.Editor)}}
<!--displayed when entry has either Author, Editor or both present-->
{{/if}}
xor
if (a && !b || !a && b)
{{#if (xor model.Author model.Editor)}}
<!--displayed when entry has either Author, Editor but not both-->
{{/if}}
gt
greater than
{{#if (gt model.Id 1000)}}
<!--displayed when entry Id is greater than 1000-->
{{/if}}
gte
greater than equal to
{{#if (gte model.Id 1000)}}
<!--displayed when entry Id is greater than and equal to 1000-->
{{/if}}
lt
less than
{{#if (lt model.Id 1000)}}
<!--displayed when entry Id is less than 1000-->
{{/if}}
lte
less than equal to
{{#if (lte model.Id 1000)}}
<!--displayed when entry Id is less than equal to 1000-->
{{/if}}
is-array
is of Array type
{{#if (is-array a)}}
<!--displayed when a is of type array-->
{{/if}}
is-empty
is an Array or object is empty
{{#if (is-empty model.MemberIds)}}
<!--displayed when entry has no members-->
{{/if}}
is-equal
compares if two objects are equal
{{#if (is-equal a b)}}
<!--displayed when object a and b are equal-->
{{/if}}
includes
Checks if a string contains (as sub-string) a specific value.
{{#if (includes model.Title "Test")}}
<!--displayed when entry title contains Test -->
{{/if}}
ends-with
Checks if a string ends with a specific value
{{#if (ends-with legacyController.contentManagerContextMenu.DPEVersion "1.200")}}
<!--displayed when current DPE version ends with 1.200 -->
{{/if}}
starts-with
Checks if a string starts with a specific value.
{{#if (starts-with legacyController.contentManagerContextMenu.DPEVersion "1.14")}}
<!--displayed when Current DPE version starts with 1.14 -->
{{/if}}
version-between
Checks if a version string (like legacyController.contentManagerContextMenu.DPEVersion) is between two provided versions.
{{#if (version-between legacyController.contentManagerContextMenu.DPEVersion "0.0.0.0" "1.14.123.0")}}
<!-- displayed when Current DPE version is less or equal than 1.14.123.0 -->
{{/if}}
{{#if (version-between legacyController.contentManagerContextMenu.DPEVersion "1.14.123.0" "99.0.0.0")}}
<!-- displayed when Current DPE version is bigger or equal than 1.14.123.0 -->
{{/if}}
{{#if (version-between legacyController.contentManagerContextMenu.DPEVersion "1.14.123.0" "2.2.18.0")}}
<!-- displayed when Current DPE version is 1.14.123.0 or newer, but not newer than 2.2.18.0 -->
{{/if}}