Yield

Output a section of template that was captured with a Section Tag.


Example

Here’s an example template:

<h1>&lbrace;&lbrace; title &rbrace;&rbrace;</h1>
<div>
    &lbrace;&lbrace; content &rbrace;&rbrace;
</div>

&lbrace;&lbrace; section:sidebar &rbrace;&rbrace;
    Some sidebar stuff!
&lbrace;&lbrace; /section:sidebar &rbrace;&rbrace;

and here’s an example layout:

<html>
<body>
    <header>...</header>

    <section>
        &lbrace;&lbrace; template_content &rbrace;&rbrace;
    </section>

    <aside>
        &lbrace;&lbrace; yield:sidebar &rbrace;&rbrace;
    </aside>
</body>
</html>

Everything within the section:sidebar tag pair will not be rendered in template_content. Instead, it will be rendered by the &lbrace;&lbrace; yield:sidebar &rbrace;&rbrace; tag.

Fallback content

If a section has not been created, the yield tag may contain fallback content by using a tag pair.

In the example above, let’s assume that there was no &lbrace;&lbrace; section:sidebar &rbrace;&rbrace; used in the template.

<aside>
    &lbrace;&lbrace; yield:sidebar &rbrace;&rbrace;
        This text will be shown since section:sidebar was never used!
    &lbrace;&lbrace; /yield:sidebar &rbrace;&rbrace;
</aside>
Last modified on September 21, 2016