Changes the context within a block to a specified object so that you can access properties without repeating the object name. This built-in helper is provided by the Handlebars.Net library.
Availability
This helper is available in the Winter ’26 release of Marketing Cloud Next.
Syntax
{{#with object}}
Value1: {{value1}}
Value2: {{value2}}
...
{{/with}}
Parameters
| Parameter | Type | Description |
|---|---|---|
object |
Object | Required. The object to use as the context within the block. |
Return Value
The function renders the block template with the specified object as the context. Within the block, you can access properties directly without the object name. You can access the root context using @root. This code example shows how to access the root context.
{{#with user}}
User: {{name}}
Root context: {{@root.title}}
{{/with}}
You can also access the parent context using the ../ syntax. This code example shows how to access the parent context.
{{#with user}}
User: {{name}}
Parent context: {{../title}}
{{/with}}
See Also
- Github: Handlebars.Net
- Handlebars Language Guide: Built-in Helpers