Extends

{% extends 'index.html' %}
{% block content %}
  <h1>{{ this.title }}</h1>
  {{ this.content }}
{% endblock content %}

Extending is one of the most important tools available when putting together clean templates. By using the 'extends' keyword, you are telling Twig that this is a child template. The other template that you are extending is the parent template.

The parent template will be used, but have it's blocks filled in with what you specify in the child template. In the example above, a title and content will be filled into index.html's 'content' block.

You can send as many blocks as you like up to the parent template. Even if the parent nests blocks, you can send them up individually.