# extends

Source: https://zotonic.com/docs/1347/extends

URI: https://zotonic.com/id/1347

Language: en



::: {.aside}
See also

<a href="/id/doc_template_tag_tag_block" class="doc-reference doc-reference-tag"><code>tag#block</code></a>, <a href="/id/doc_template_tag_tag_inherit" class="doc-reference doc-reference-tag"><code>tag#inherit</code></a>, <a href="/id/doc_template_tag_tag_fragment" class="doc-reference doc-reference-tag"><code>tag#fragment</code></a> and <a href="/id/doc_template_tag_tag_overrules" class="doc-reference doc-reference-tag"><code>tag#overrules</code></a>.
:::

Inherit markup from another template.

::: {.note title="Note"}
A template that extends another template contains only the extends tag and template <a href="/id/doc_template_tag_tag_block" class="doc-reference doc-reference-tag"><code>tag#block</code></a> tags.
:::

Signal that this template extends another template. The extends tag must be the first tag in a template that inherits from another template.

Example:

```django
{% extends "base.tpl" %}
```

All named template blocks in this template will replace the similar named template blocks in the template base.tpl.

Unlike Django the template name must be a string literal, variables are not allowed.

Arguments
---------

The `extends` tag can pass extra variables to the extended template and inherited fragments:

```django
{% extends "base.tpl" section="news" %}
```

For compatibility with other tags, the `with` keyword is also accepted:

```django
{% extends "base.tpl" with section="news" %}
```

These arguments extend the current template context while the extended template is rendered.

License: 

Attribution: 

Related resources: https://zotonic.com/api/agent/related/1347?language=en


## API access

- [API help](<https://zotonic.com/api-help>)
- [OpenAPI specification](<https://zotonic.com/openapi.json>)
- [This resource as JSON](<https://zotonic.com/api/agent/resource/1347?language=en>)
