Override Block in Page

Hi@all,
is it possible to override (or extend) an existing block which is defined in a template?

I want to include a special JS-file on a specific page. So I tried to “override” the javascrips block which is defined in “base.html.twig”.

{% block javascrips %}
    {# Google Maps #}
    {% do assets.add('//maps.googleapis.com/maps/api/js?sensor=false') %}
{% endblock %}

but it doesn’t work.

You need to use the parent() twig function:

http://twig.sensiolabs.org/doc/tags/extends.html#parent-blocks

Btw you have a typo. Should be {% block javascripts %}

thx for your fast respone,

I already tried to use the parent function:

{% block javascripts %}
    {# Google Maps #}
    {% do assets.add('//maps.googleapis.com/maps/api/js?sensor=false') %}

    {{ parent() }}
{% endblock %}

but then I get the following error message:

Calling "parent" on a template that does not extend nor "use" another template is forbidden in "@Page:/is/htdocs/***/***/***/user/pages/02.kanzlei/03.kontakt" at line 5
---

Oh yes you need to extend the base template first.

I suggest you read the entire section on Extends of the Twig docs:

http://twig.sensiolabs.org/doc/tags/extends.html