mrdocs::Handlebars::registerPartial

Register a partial

Synopsis

Declared in <mrdocs/Support/Handlebars.hpp>

void
registerPartial(
    std::string_view name,
    std::string_view text);

Description

This function registers a partial with the handlebars environment.

A partial is a template that can be referenced from another template. The partial is rendered in the context of the template that references it.

For instance, a partial can be used to render a header or footer that is common to several pages. It can also be used to render a list of items that is used in several places.

The following example template uses the partial item to render a list of items:

{.handlebars}
        <ul>
        {{#each items}}
            {{> item}}
        {{/each}}
        </ul>

Parameters

Name Description

name

The name of the partial

text

The content of the partial

See Also

https://handlebarsjs.com/guide/partials.html

Created with MrDocs