Template Inheritance

ADX supports Jinja's template inheritance features, allowing you to reuse and extend template definitions. The templates are referenced by their keys defined in Templates and Assets → ADX Templates.

Include

The {% include %} tag allows you to include the content of another template within the current template.

<adx>
  <body>
    {% include "header_template" %}
    <text>Main content here</text>
    {% include "footer_template" %}
  </body>
</adx>

Extends

The {% extends %} tag enables template inheritance. A child template can extend a base template and override specific blocks.

Base template (base_layout):

<adx>
  <pageTemplates>
    <template id="letterhead" pageSize="A4">
      <text bottom="280mm" left="20mm">Company Letterhead</text>
    </template>
  </pageTemplates>
  <body template="letterhead">
    {% block content %}{% endblock %}
  </body>
</adx>

Child template:

Use {{ super() }} to render the parent block's content:

Import

The {% import %} tag allows you to import macros and variables from another template.

Helper template (common_macros):

Using the template:

Template Keys

All template references (include, extends, import) use the key defined in Templates and Assets → ADX Templates. These keys are unique identifiers for your template definitions.

Last updated

Was this helpful?