Use blocks to inject content into specific layout locations
masterBlocks allow you to move specific parts of a view to designated placeholders in a layout.
- In the View: Wrap the content you want to move in
{-block_name-}tags. - In the Layout: Access the content via the
blockstable using{*blocks.block_name*}.
view.html:
<h1>{{message}}</h1>
{-aside-}
<ul>
{% for _, keyword in ipairs(keywords) do %}
<li>{{keyword}}</li>
{% end %}
</ul>
{-aside-}layout.html:
<body>
{*view*}
{% if blocks.aside then %}
<aside>
{*blocks.aside*}
</aside>
{% end %}
</body>
</html><h1>{{message}}</h1>
{-aside-}
<ul
{% for _, keyword in ipairs(keywords) do %}
<li>{{keyword}}</li>
{% end %}
</ul>
{-aside-}