Template Inheritance

Template inheritance is a way to define base template structure and reuse it in multiple places. The parent templates define areas for the child templates to overwrite with the "block" keyword. The child inherits this template with the "extends" keyword.

Example: if we have the parent template base.jade:

// base.jade
h1 Hello from the base
block content

And we want our child to use it:

// child.jade
extends base
block content
    p This is the child's content


This will output:

<h1>Hello from the base</h1>
<p>This is the child's content</p>

Templates can have many blocks and inherit multiple levels.