2022.1

Table Of Contents
Using a registered partial in a template
Registered partials (see "How to register a partial" on the previous page) can be referred to by
name instead of file name, using the following syntax: {{> partialName}}.
For example, a partial that is registered as follows:
Handlebars.registerPartial('clauses', 'snippets/partials/clauses.hbs');
can be included in a Handlebars template with the following expression: {{> clauses}}.
When a partial is missing
If there is no partial with the specified name, Handlebars can generate some other content,
called failover content. Failover content can be specified using block syntax. The expression
that calls the partial is the start of a block. An expression with a closing tag and the name of the
partial signals the end of the block. The content between these expressions will be used if the
called partial is missing.
For example: {{#> myPartial }} Failover content {{/myPartial}} will render "Failover content" if the
"myPartial" partial is not registered.
Dynamic partials
To load partials dynamically, based on data, you could use a block helper (see "Using logic in
a Handlebars template: helpers" on page982 and "Using Handlebars templates: examples" on
page784).
It is also possible to dynamically select a partial by using a sub expression between
parentheses. The sub expression should evaluate to the name of a partial.
For example, if whichPartial is a function that returns the name of a partial, {{> (whichPartial)
}} in a Handlebars template calls whichPartial and then renders the partial whose name is
returned by this function.
Note that to use a function in this way, it must be registered as a helper. See "Adding custom
helpers" on page985.
Inline partials
Inline partials are supported as well. See the two examples at
https://docs.w3cub.com/handlebars/partials#inline-partials.
Page 989