Directive: extend

Last updated 8 months ago

Jael supports template inheritance by means of extend and block.

Note the following example:

<!-- layout.jl -->
<title>{{ title }} - My App</title>
<block name="content"></block>
<div class="footer">
<!-- Footer content... -->
<!-- hello.jl -->
<extend src="layout.jl">
<block name="content">
<img src=user.avatar ?? "">
Hello, {{ }}!

To extend a layout, instead of the file containing an <html> node, create a file with an <extend> node. The src attribute should point to the correct file. Then, add <block> tags that will replace the corresponding <block> tags declared in the parent file.