include Tag

Inserts and executes a partial file from the partials/ folder of the theme.

Description

Inserts and executes a partial file from the partials folder of the theme.

{% include 'header' %}

Note that the .liquid extension is omitted when making this call.

The code within an included partial will have access to the variables available to its parent template.

You can also choose to set additional variables available to the included partial when calling the include tag:

      {% include 'report', show_action_links: false, printable: true %}
      

Parameters

with

As a shortcut, this parameters allows you to assign a value to a variable inside the included partial that shares the same name as the template.

In this example, the template at partials/color.liquid will have a variable named color available with the value red:

{% include 'color' with 'red' %}