capture
You can use Handlebars helpers and variables to create complex string variables.
Parameters
variable{String}: The variable name. This parameter is required.returns{String}
Usage
{{#capture variable }} value {{/capture}}
Example
{{ assign 'title1' (upcase collection.title) }}
{{ assign 'title2' (downcase collection.title) }}
{{ assign 'show_title1' true }}
{{#capture 'res_title'}}
{{#if show_title1}}
Upcase title: {{ title1 }}
{{else}}
Downcase title: {{ title2 }}
{{/if}}
{{/capture}}
{{ res_title }}
Was this article helpful to you?