Skip to documentation content

Content methods

Content methods

Object methods that fetch a single CMS object into the template.

{% article %}

{% article output_to_template? [[var, set, or assign]? variable_name]? output_to_template? = value %}
Parameters
output_to_template optionalflag
Include this flag to write the article's output into the page at this point. What that output is differs by type, and for most types it is a built-in default that may change at any time, so see the output property of the article object before relying on it. The flag may come before or after the variable name. When the call names no variable, the output is written whether or not the flag is present, which makes {% article = value %} the smallest valid use of this method. When the call names a variable, the flag saves the article to the variable and writes its output as well.
var, set, or assign optionalkeyword
Chooses the scope that holds the variable. var, the default, stores it in the current scope. set and assign can store it in outer scopes; Variable Scopes compares the three and when each fits.
variable_name optionalvariable
The variable that receives the article. It may also be written as a reference, &name, which reads the variable's name from another variable (see Methods Overview). Leave it out to write the article to the template instead.
value requiredexpression
Required; without a value the method call is not valid. Identifies which article to fetch. It can evaluate to the article itself, to its GUID, or to other text that identifies it, which for most types is its name; a type identified some other way, or only by GUID, says so in its summary. Names are matched without regard to case, but accented letters must match. A GUID identifies exactly one record, whereas when several records share a name, which of them is returned is not specified, so giving the records you fetch by name unique names avoids the question. A name reads better in a template and a GUID is exact; neither suits every site. When nothing matches, no error is raised: the variable holds an invalid article, whose is_valid is false, so check is_valid before using it. When the expression itself has no value, for example an undefined variable, the method does nothing and the variable keeps any earlier value. May use liquid filters.

Fetches a single {{ article }}.

{% author %}

{% author output_to_template? [[var, set, or assign]? variable_name]? output_to_template? = value %}
Parameters
output_to_template optionalflag
Include this flag to write the author's output into the page at this point. What that output is differs by type, and for most types it is a built-in default that may change at any time, so see the output property of the author object before relying on it. The flag may come before or after the variable name. When the call names no variable, the output is written whether or not the flag is present, which makes {% author = value %} the smallest valid use of this method. When the call names a variable, the flag saves the author to the variable and writes its output as well.
var, set, or assign optionalkeyword
Chooses the scope that holds the variable. var, the default, stores it in the current scope. set and assign can store it in outer scopes; Variable Scopes compares the three and when each fits.
variable_name optionalvariable
The variable that receives the author. It may also be written as a reference, &name, which reads the variable's name from another variable (see Methods Overview). Leave it out to write the author to the template instead.
value requiredexpression
Required; without a value the method call is not valid. Identifies which author to fetch. It can evaluate to the author itself, to its GUID, or to other text that identifies it, which for most types is its name; a type identified some other way, or only by GUID, says so in its summary. Names are matched without regard to case, but accented letters must match. A GUID identifies exactly one record, whereas when several records share a name, which of them is returned is not specified, so giving the records you fetch by name unique names avoids the question. A name reads better in a template and a GUID is exact; neither suits every site. When nothing matches, no error is raised: the variable holds an invalid author, whose is_valid is false, so check is_valid before using it. When the expression itself has no value, for example an undefined variable, the method does nothing and the variable keeps any earlier value. May use liquid filters.

Fetches a single {{ author }}.

{% blog %}

{% blog output_to_template? [[var, set, or assign]? variable_name]? output_to_template? = value %}
Parameters
output_to_template optionalflag
Include this flag to write the blog's output into the page at this point. What that output is differs by type, and for most types it is a built-in default that may change at any time, so see the output property of the blog object before relying on it. The flag may come before or after the variable name. When the call names no variable, the output is written whether or not the flag is present, which makes {% blog = value %} the smallest valid use of this method. When the call names a variable, the flag saves the blog to the variable and writes its output as well.
var, set, or assign optionalkeyword
Chooses the scope that holds the variable. var, the default, stores it in the current scope. set and assign can store it in outer scopes; Variable Scopes compares the three and when each fits.
variable_name optionalvariable
The variable that receives the blog. It may also be written as a reference, &name, which reads the variable's name from another variable (see Methods Overview). Leave it out to write the blog to the template instead.
value requiredexpression
Required; without a value the method call is not valid. Identifies which blog to fetch. It can evaluate to the blog itself, to its GUID, or to other text that identifies it, which for most types is its name; a type identified some other way, or only by GUID, says so in its summary. Names are matched without regard to case, but accented letters must match. A GUID identifies exactly one record, whereas when several records share a name, which of them is returned is not specified, so giving the records you fetch by name unique names avoids the question. A name reads better in a template and a GUID is exact; neither suits every site. When nothing matches, no error is raised: the variable holds an invalid blog, whose is_valid is false, so check is_valid before using it. When the expression itself has no value, for example an undefined variable, the method does nothing and the variable keeps any earlier value. May use liquid filters.

Fetches a single {{ blog }}.

{% blog_post %}

{% blog_post output_to_template? [[var, set, or assign]? variable_name]? output_to_template? = value %}
Parameters
output_to_template optionalflag
Include this flag to write the blog_post's output into the page at this point. What that output is differs by type, and for most types it is a built-in default that may change at any time, so see the output property of the blog_post object before relying on it. The flag may come before or after the variable name. When the call names no variable, the output is written whether or not the flag is present, which makes {% blog_post = value %} the smallest valid use of this method. When the call names a variable, the flag saves the blog_post to the variable and writes its output as well.
var, set, or assign optionalkeyword
Chooses the scope that holds the variable. var, the default, stores it in the current scope. set and assign can store it in outer scopes; Variable Scopes compares the three and when each fits.
variable_name optionalvariable
The variable that receives the blog_post. It may also be written as a reference, &name, which reads the variable's name from another variable (see Methods Overview). Leave it out to write the blog_post to the template instead.
value requiredexpression
Required; without a value the method call is not valid. Identifies which blog_post to fetch. It can evaluate to the blog_post itself, to its GUID, or to other text that identifies it, which for most types is its name; a type identified some other way, or only by GUID, says so in its summary. Names are matched without regard to case, but accented letters must match. A GUID identifies exactly one record, whereas when several records share a name, which of them is returned is not specified, so giving the records you fetch by name unique names avoids the question. A name reads better in a template and a GUID is exact; neither suits every site. When nothing matches, no error is raised: the variable holds an invalid blog_post, whose is_valid is false, so check is_valid before using it. When the expression itself has no value, for example an undefined variable, the method does nothing and the variable keeps any earlier value. May use liquid filters.

Fetches a single {{ blog_post }}.

{% calendar %}

{% calendar output_to_template? [[var, set, or assign]? variable_name]? output_to_template? = value %}
Parameters
output_to_template optionalflag
Include this flag to write the calendar's output into the page at this point. What that output is differs by type, and for most types it is a built-in default that may change at any time, so see the output property of the calendar object before relying on it. The flag may come before or after the variable name. When the call names no variable, the output is written whether or not the flag is present, which makes {% calendar = value %} the smallest valid use of this method. When the call names a variable, the flag saves the calendar to the variable and writes its output as well.
var, set, or assign optionalkeyword
Chooses the scope that holds the variable. var, the default, stores it in the current scope. set and assign can store it in outer scopes; Variable Scopes compares the three and when each fits.
variable_name optionalvariable
The variable that receives the calendar. It may also be written as a reference, &name, which reads the variable's name from another variable (see Methods Overview). Leave it out to write the calendar to the template instead.
value requiredexpression
Required; without a value the method call is not valid. Identifies which calendar to fetch. It can evaluate to the calendar itself, to its GUID, or to other text that identifies it, which for most types is its name; a type identified some other way, or only by GUID, says so in its summary. Names are matched without regard to case, but accented letters must match. A GUID identifies exactly one record, whereas when several records share a name, which of them is returned is not specified, so giving the records you fetch by name unique names avoids the question. A name reads better in a template and a GUID is exact; neither suits every site. When nothing matches, no error is raised: the variable holds an invalid calendar, whose is_valid is false, so check is_valid before using it. When the expression itself has no value, for example an undefined variable, the method does nothing and the variable keeps any earlier value. May use liquid filters.

Fetches a single {{ calendar }}.

{% calendar_entry %}

{% calendar_entry output_to_template? [[var, set, or assign]? variable_name]? output_to_template? = value %}
Parameters
output_to_template optionalflag
Include this flag to write the calendar_entry's output into the page at this point. What that output is differs by type, and for most types it is a built-in default that may change at any time, so see the output property of the calendar_entry object before relying on it. The flag may come before or after the variable name. When the call names no variable, the output is written whether or not the flag is present, which makes {% calendar_entry = value %} the smallest valid use of this method. When the call names a variable, the flag saves the calendar_entry to the variable and writes its output as well.
var, set, or assign optionalkeyword
Chooses the scope that holds the variable. var, the default, stores it in the current scope. set and assign can store it in outer scopes; Variable Scopes compares the three and when each fits.
variable_name optionalvariable
The variable that receives the calendar_entry. It may also be written as a reference, &name, which reads the variable's name from another variable (see Methods Overview). Leave it out to write the calendar_entry to the template instead.
value requiredexpression
Required; without a value the method call is not valid. Identifies which calendar_entry to fetch. It can evaluate to the calendar_entry itself, to its GUID, or to other text that identifies it, which for most types is its name; a type identified some other way, or only by GUID, says so in its summary. Names are matched without regard to case, but accented letters must match. A GUID identifies exactly one record, whereas when several records share a name, which of them is returned is not specified, so giving the records you fetch by name unique names avoids the question. A name reads better in a template and a GUID is exact; neither suits every site. When nothing matches, no error is raised: the variable holds an invalid calendar_entry, whose is_valid is false, so check is_valid before using it. When the expression itself has no value, for example an undefined variable, the method does nothing and the variable keeps any earlier value. May use liquid filters.

Fetches a single {{ calendar_entry }}.

{% datastore %}

{% datastore output_to_template? [[var, set, or assign]? variable_name]? output_to_template? = value %}
Parameters
output_to_template optionalflag
Include this flag to write the datastore's output into the page at this point. What that output is differs by type, and for most types it is a built-in default that may change at any time, so see the output property of the datastore object before relying on it. The flag may come before or after the variable name. When the call names no variable, the output is written whether or not the flag is present, which makes {% datastore = value %} the smallest valid use of this method. When the call names a variable, the flag saves the datastore to the variable and writes its output as well.
var, set, or assign optionalkeyword
Chooses the scope that holds the variable. var, the default, stores it in the current scope. set and assign can store it in outer scopes; Variable Scopes compares the three and when each fits.
variable_name optionalvariable
The variable that receives the datastore. It may also be written as a reference, &name, which reads the variable's name from another variable (see Methods Overview). Leave it out to write the datastore to the template instead.
value requiredexpression
Required; without a value the method call is not valid. Identifies which datastore to fetch. It can evaluate to the datastore itself, to its GUID, or to other text that identifies it, which for most types is its name; a type identified some other way, or only by GUID, says so in its summary. Names are matched without regard to case, but accented letters must match. A GUID identifies exactly one record, whereas when several records share a name, which of them is returned is not specified, so giving the records you fetch by name unique names avoids the question. A name reads better in a template and a GUID is exact; neither suits every site. When nothing matches, no error is raised: the variable holds an invalid datastore, whose is_valid is false, so check is_valid before using it. When the expression itself has no value, for example an undefined variable, the method does nothing and the variable keeps any earlier value. May use liquid filters.

Fetches a single {{ datastore }}.

{% datastore_item %}

{% datastore_item output_to_template? [[var, set, or assign]? variable_name]? output_to_template? = value %}
Parameters
output_to_template optionalflag
Include this flag to write the datastore_item's output into the page at this point. What that output is differs by type, and for most types it is a built-in default that may change at any time, so see the output property of the datastore_item object before relying on it. The flag may come before or after the variable name. When the call names no variable, the output is written whether or not the flag is present, which makes {% datastore_item = value %} the smallest valid use of this method. When the call names a variable, the flag saves the datastore_item to the variable and writes its output as well.
var, set, or assign optionalkeyword
Chooses the scope that holds the variable. var, the default, stores it in the current scope. set and assign can store it in outer scopes; Variable Scopes compares the three and when each fits.
variable_name optionalvariable
The variable that receives the datastore_item. It may also be written as a reference, &name, which reads the variable's name from another variable (see Methods Overview). Leave it out to write the datastore_item to the template instead.
value requiredexpression
Required; without a value the method call is not valid. Identifies which datastore_item to fetch. It can evaluate to the datastore_item itself, to its GUID, or to other text that identifies it, which for most types is its name; a type identified some other way, or only by GUID, says so in its summary. Names are matched without regard to case, but accented letters must match. A GUID identifies exactly one record, whereas when several records share a name, which of them is returned is not specified, so giving the records you fetch by name unique names avoids the question. A name reads better in a template and a GUID is exact; neither suits every site. When nothing matches, no error is raised: the variable holds an invalid datastore_item, whose is_valid is false, so check is_valid before using it. When the expression itself has no value, for example an undefined variable, the method does nothing and the variable keeps any earlier value. May use liquid filters.

Fetches a single {{ datastore_item }}.

{% document %}

{% document output_to_template? [[var, set, or assign]? variable_name]? output_to_template? = value %}
Parameters
output_to_template optionalflag
Include this flag to write the document's output into the page at this point. What that output is differs by type, and for most types it is a built-in default that may change at any time, so see the output property of the document object before relying on it. The flag may come before or after the variable name. When the call names no variable, the output is written whether or not the flag is present, which makes {% document = value %} the smallest valid use of this method. When the call names a variable, the flag saves the document to the variable and writes its output as well.
var, set, or assign optionalkeyword
Chooses the scope that holds the variable. var, the default, stores it in the current scope. set and assign can store it in outer scopes; Variable Scopes compares the three and when each fits.
variable_name optionalvariable
The variable that receives the document. It may also be written as a reference, &name, which reads the variable's name from another variable (see Methods Overview). Leave it out to write the document to the template instead.
value requiredexpression
Required; without a value the method call is not valid. Identifies which document to fetch. It can evaluate to the document itself, to its GUID, or to other text that identifies it, which for most types is its name; a type identified some other way, or only by GUID, says so in its summary. Names are matched without regard to case, but accented letters must match. A GUID identifies exactly one record, whereas when several records share a name, which of them is returned is not specified, so giving the records you fetch by name unique names avoids the question. A name reads better in a template and a GUID is exact; neither suits every site. When nothing matches, no error is raised: the variable holds an invalid document, whose is_valid is false, so check is_valid before using it. When the expression itself has no value, for example an undefined variable, the method does nothing and the variable keeps any earlier value. May use liquid filters.

Fetches a single {{ document }}.

{% error_page %}

{% error_page output_to_template? [[var, set, or assign]? variable_name]? output_to_template? = value %}
Parameters
output_to_template optionalflag
Include this flag to write the error_page's output into the page at this point. What that output is differs by type, and for most types it is a built-in default that may change at any time, so see the output property of the error_page object before relying on it. The flag may come before or after the variable name. When the call names no variable, the output is written whether or not the flag is present, which makes {% error_page = value %} the smallest valid use of this method. When the call names a variable, the flag saves the error_page to the variable and writes its output as well.
var, set, or assign optionalkeyword
Chooses the scope that holds the variable. var, the default, stores it in the current scope. set and assign can store it in outer scopes; Variable Scopes compares the three and when each fits.
variable_name optionalvariable
The variable that receives the error_page. It may also be written as a reference, &name, which reads the variable's name from another variable (see Methods Overview). Leave it out to write the error_page to the template instead.
value requiredexpression
Required; without a value the method call is not valid. Identifies which error_page to fetch. It can evaluate to the error_page itself, to its GUID, or to other text that identifies it, which for most types is its name; a type identified some other way, or only by GUID, says so in its summary. Names are matched without regard to case, but accented letters must match. A GUID identifies exactly one record, whereas when several records share a name, which of them is returned is not specified, so giving the records you fetch by name unique names avoids the question. A name reads better in a template and a GUID is exact; neither suits every site. When nothing matches, no error is raised: the variable holds an invalid error_page, whose is_valid is false, so check is_valid before using it. When the expression itself has no value, for example an undefined variable, the method does nothing and the variable keeps any earlier value. May use liquid filters.

Fetches a single {{ error_page }}.

{% folder %}

Identifies the folder by its path: the names of the folders from a top-level folder down, separated by /. If two folders at the same level of the path share a name, the path does not resolve.

{% folder output_to_template? [[var, set, or assign]? variable_name]? output_to_template? = value %}
Parameters
output_to_template optionalflag
Include this flag to write the folder's output into the page at this point. What that output is differs by type, and for most types it is a built-in default that may change at any time, so see the output property of the folder object before relying on it. The flag may come before or after the variable name. When the call names no variable, the output is written whether or not the flag is present, which makes {% folder = value %} the smallest valid use of this method. When the call names a variable, the flag saves the folder to the variable and writes its output as well.
var, set, or assign optionalkeyword
Chooses the scope that holds the variable. var, the default, stores it in the current scope. set and assign can store it in outer scopes; Variable Scopes compares the three and when each fits.
variable_name optionalvariable
The variable that receives the folder. It may also be written as a reference, &name, which reads the variable's name from another variable (see Methods Overview). Leave it out to write the folder to the template instead.
value requiredexpression
Required; without a value the method call is not valid. Identifies which folder to fetch. It can evaluate to the folder itself, to its GUID, or to other text that identifies it, which for most types is its name; a type identified some other way, or only by GUID, says so in its summary. Names are matched without regard to case, but accented letters must match. A GUID identifies exactly one record, whereas when several records share a name, which of them is returned is not specified, so giving the records you fetch by name unique names avoids the question. A name reads better in a template and a GUID is exact; neither suits every site. When nothing matches, no error is raised: the variable holds an invalid folder, whose is_valid is false, so check is_valid before using it. When the expression itself has no value, for example an undefined variable, the method does nothing and the variable keeps any earlier value. May use liquid filters.

Fetches a single {{ folder }}.

{% form %}

{% form output_to_template? [[var, set, or assign]? variable_name]? output_to_template? = value %}
Parameters
output_to_template optionalflag
Include this flag to write the form's output into the page at this point. What that output is differs by type, and for most types it is a built-in default that may change at any time, so see the output property of the form object before relying on it. The flag may come before or after the variable name. When the call names no variable, the output is written whether or not the flag is present, which makes {% form = value %} the smallest valid use of this method. When the call names a variable, the flag saves the form to the variable and writes its output as well.
var, set, or assign optionalkeyword
Chooses the scope that holds the variable. var, the default, stores it in the current scope. set and assign can store it in outer scopes; Variable Scopes compares the three and when each fits.
variable_name optionalvariable
The variable that receives the form. It may also be written as a reference, &name, which reads the variable's name from another variable (see Methods Overview). Leave it out to write the form to the template instead.
value requiredexpression
Required; without a value the method call is not valid. Identifies which form to fetch. It can evaluate to the form itself, to its GUID, or to other text that identifies it, which for most types is its name; a type identified some other way, or only by GUID, says so in its summary. Names are matched without regard to case, but accented letters must match. A GUID identifies exactly one record, whereas when several records share a name, which of them is returned is not specified, so giving the records you fetch by name unique names avoids the question. A name reads better in a template and a GUID is exact; neither suits every site. When nothing matches, no error is raised: the variable holds an invalid form, whose is_valid is false, so check is_valid before using it. When the expression itself has no value, for example an undefined variable, the method does nothing and the variable keeps any earlier value. May use liquid filters.

Fetches a single {{ form }}.

{% form_submit %}

Has no name lookup: it takes a form_submit object or the GUID of one.

{% form_submit output_to_template? [[var, set, or assign]? variable_name]? output_to_template? = value %}
Parameters
output_to_template optionalflag
Include this flag to write the form_submit's output into the page at this point. What that output is differs by type, and for most types it is a built-in default that may change at any time, so see the output property of the form_submit object before relying on it. The flag may come before or after the variable name. When the call names no variable, the output is written whether or not the flag is present, which makes {% form_submit = value %} the smallest valid use of this method. When the call names a variable, the flag saves the form_submit to the variable and writes its output as well.
var, set, or assign optionalkeyword
Chooses the scope that holds the variable. var, the default, stores it in the current scope. set and assign can store it in outer scopes; Variable Scopes compares the three and when each fits.
variable_name optionalvariable
The variable that receives the form_submit. It may also be written as a reference, &name, which reads the variable's name from another variable (see Methods Overview). Leave it out to write the form_submit to the template instead.
value requiredexpression
Required; without a value the method call is not valid. Identifies which form_submit to fetch. It can evaluate to the form_submit itself, to its GUID, or to other text that identifies it, which for most types is its name; a type identified some other way, or only by GUID, says so in its summary. Names are matched without regard to case, but accented letters must match. A GUID identifies exactly one record, whereas when several records share a name, which of them is returned is not specified, so giving the records you fetch by name unique names avoids the question. A name reads better in a template and a GUID is exact; neither suits every site. When nothing matches, no error is raised: the variable holds an invalid form_submit, whose is_valid is false, so check is_valid before using it. When the expression itself has no value, for example an undefined variable, the method does nothing and the variable keeps any earlier value. May use liquid filters.

Fetches a single {{ form_submit }}.

{% gallery %}

{% gallery output_to_template? [[var, set, or assign]? variable_name]? output_to_template? = value %}
Parameters
output_to_template optionalflag
Include this flag to write the gallery's output into the page at this point. What that output is differs by type, and for most types it is a built-in default that may change at any time, so see the output property of the gallery object before relying on it. The flag may come before or after the variable name. When the call names no variable, the output is written whether or not the flag is present, which makes {% gallery = value %} the smallest valid use of this method. When the call names a variable, the flag saves the gallery to the variable and writes its output as well.
var, set, or assign optionalkeyword
Chooses the scope that holds the variable. var, the default, stores it in the current scope. set and assign can store it in outer scopes; Variable Scopes compares the three and when each fits.
variable_name optionalvariable
The variable that receives the gallery. It may also be written as a reference, &name, which reads the variable's name from another variable (see Methods Overview). Leave it out to write the gallery to the template instead.
value requiredexpression
Required; without a value the method call is not valid. Identifies which gallery to fetch. It can evaluate to the gallery itself, to its GUID, or to other text that identifies it, which for most types is its name; a type identified some other way, or only by GUID, says so in its summary. Names are matched without regard to case, but accented letters must match. A GUID identifies exactly one record, whereas when several records share a name, which of them is returned is not specified, so giving the records you fetch by name unique names avoids the question. A name reads better in a template and a GUID is exact; neither suits every site. When nothing matches, no error is raised: the variable holds an invalid gallery, whose is_valid is false, so check is_valid before using it. When the expression itself has no value, for example an undefined variable, the method does nothing and the variable keeps any earlier value. May use liquid filters.

Fetches a single {{ gallery }}.

{% image %}

{% image output_to_template? [[var, set, or assign]? variable_name]? output_to_template? = value %}
Parameters
output_to_template optionalflag
Include this flag to write the image's output into the page at this point. What that output is differs by type, and for most types it is a built-in default that may change at any time, so see the output property of the image object before relying on it. The flag may come before or after the variable name. When the call names no variable, the output is written whether or not the flag is present, which makes {% image = value %} the smallest valid use of this method. When the call names a variable, the flag saves the image to the variable and writes its output as well.
var, set, or assign optionalkeyword
Chooses the scope that holds the variable. var, the default, stores it in the current scope. set and assign can store it in outer scopes; Variable Scopes compares the three and when each fits.
variable_name optionalvariable
The variable that receives the image. It may also be written as a reference, &name, which reads the variable's name from another variable (see Methods Overview). Leave it out to write the image to the template instead.
value requiredexpression
Required; without a value the method call is not valid. Identifies which image to fetch. It can evaluate to the image itself, to its GUID, or to other text that identifies it, which for most types is its name; a type identified some other way, or only by GUID, says so in its summary. Names are matched without regard to case, but accented letters must match. A GUID identifies exactly one record, whereas when several records share a name, which of them is returned is not specified, so giving the records you fetch by name unique names avoids the question. A name reads better in a template and a GUID is exact; neither suits every site. When nothing matches, no error is raised: the variable holds an invalid image, whose is_valid is false, so check is_valid before using it. When the expression itself has no value, for example an undefined variable, the method does nothing and the variable keeps any earlier value. May use liquid filters.

Fetches a single {{ image }}.

Example How to use the set_favicon method

Set favicon from the name of an image

Liquid
{% set_favicon "favicon.ico" %}

Sets the favicon to the image with the name "favicon.ico".

Set favicon from image

Liquid
{%- image img = "favicon" -%}
{%- set_favicon img -%}

Sets the favicon to the specified image object.

Set favicon from URL string

Liquid
{% set_favicon "https://domain.com/path/to/image.ico" %}

Sets the favicon to the specified URL.

{% image_preset %}

Identifies the image preset by its code rather than a name. Codes are matched without regard to case.

{% image_preset output_to_template? [[var, set, or assign]? variable_name]? output_to_template? = value %}
Parameters
output_to_template optionalflag
Include this flag to write the image_preset's output into the page at this point. What that output is differs by type, and for most types it is a built-in default that may change at any time, so see the output property of the image_preset object before relying on it. The flag may come before or after the variable name. When the call names no variable, the output is written whether or not the flag is present, which makes {% image_preset = value %} the smallest valid use of this method. When the call names a variable, the flag saves the image_preset to the variable and writes its output as well.
var, set, or assign optionalkeyword
Chooses the scope that holds the variable. var, the default, stores it in the current scope. set and assign can store it in outer scopes; Variable Scopes compares the three and when each fits.
variable_name optionalvariable
The variable that receives the image_preset. It may also be written as a reference, &name, which reads the variable's name from another variable (see Methods Overview). Leave it out to write the image_preset to the template instead.
value requiredexpression
Required; without a value the method call is not valid. Identifies which image_preset to fetch. It can evaluate to the image_preset itself, to its GUID, or to other text that identifies it, which for most types is its name; a type identified some other way, or only by GUID, says so in its summary. Names are matched without regard to case, but accented letters must match. A GUID identifies exactly one record, whereas when several records share a name, which of them is returned is not specified, so giving the records you fetch by name unique names avoids the question. A name reads better in a template and a GUID is exact; neither suits every site. When nothing matches, no error is raised: the variable holds an invalid image_preset, whose is_valid is false, so check is_valid before using it. When the expression itself has no value, for example an undefined variable, the method does nothing and the variable keeps any earlier value. May use liquid filters.

Fetches a single {{ image_preset }}.

{% javascript %}

Identifies the javascript by its path and name. The path can be absolute (it begins with /, so it is taken from the root) or relative (it is resolved against the folder of the template being rendered, and .. moves up one folder; ./ is not supported). The name is matched as stored, with no extension added or removed. {% include %} gives the full rules, which are the same here.

{% javascript output_to_template? [[var, set, or assign]? variable_name]? output_to_template? = value %}
Parameters
output_to_template optionalflag
Include this flag to write the javascript's output into the page at this point. What that output is differs by type, and for most types it is a built-in default that may change at any time, so see the output property of the javascript object before relying on it. The flag may come before or after the variable name. When the call names no variable, the output is written whether or not the flag is present, which makes {% javascript = value %} the smallest valid use of this method. When the call names a variable, the flag saves the javascript to the variable and writes its output as well.
var, set, or assign optionalkeyword
Chooses the scope that holds the variable. var, the default, stores it in the current scope. set and assign can store it in outer scopes; Variable Scopes compares the three and when each fits.
variable_name optionalvariable
The variable that receives the javascript. It may also be written as a reference, &name, which reads the variable's name from another variable (see Methods Overview). Leave it out to write the javascript to the template instead.
value requiredexpression
Required; without a value the method call is not valid. Identifies which javascript to fetch. It can evaluate to the javascript itself, to its GUID, or to other text that identifies it, which for most types is its name; a type identified some other way, or only by GUID, says so in its summary. Names are matched without regard to case, but accented letters must match. A GUID identifies exactly one record, whereas when several records share a name, which of them is returned is not specified, so giving the records you fetch by name unique names avoids the question. A name reads better in a template and a GUID is exact; neither suits every site. When nothing matches, no error is raised: the variable holds an invalid javascript, whose is_valid is false, so check is_valid before using it. When the expression itself has no value, for example an undefined variable, the method does nothing and the variable keeps any earlier value. May use liquid filters.

Fetches a single {{ javascript }}.

Example Inline javascript from templateOutput inline JavaScript from template variables (e.g. for config or data) with proper escaping.
Liquid
<script>{% include javascript "/javascript/inlined/blog" %}</script>
OR
{%- javascript js = "/javascript/inlined/blog" -%}
{%- if js is_valid -%}
<script>{% include js %}</script>
{%- endif -%}

{% menu %}

{% menu output_to_template? [[var, set, or assign]? variable_name]? output_to_template? = value %}
Parameters
output_to_template optionalflag
Include this flag to write the menu's output into the page at this point. What that output is differs by type, and for most types it is a built-in default that may change at any time, so see the output property of the menu object before relying on it. The flag may come before or after the variable name. When the call names no variable, the output is written whether or not the flag is present, which makes {% menu = value %} the smallest valid use of this method. When the call names a variable, the flag saves the menu to the variable and writes its output as well.
var, set, or assign optionalkeyword
Chooses the scope that holds the variable. var, the default, stores it in the current scope. set and assign can store it in outer scopes; Variable Scopes compares the three and when each fits.
variable_name optionalvariable
The variable that receives the menu. It may also be written as a reference, &name, which reads the variable's name from another variable (see Methods Overview). Leave it out to write the menu to the template instead.
value requiredexpression
Required; without a value the method call is not valid. Identifies which menu to fetch. It can evaluate to the menu itself, to its GUID, or to other text that identifies it, which for most types is its name; a type identified some other way, or only by GUID, says so in its summary. Names are matched without regard to case, but accented letters must match. A GUID identifies exactly one record, whereas when several records share a name, which of them is returned is not specified, so giving the records you fetch by name unique names avoids the question. A name reads better in a template and a GUID is exact; neither suits every site. When nothing matches, no error is raised: the variable holds an invalid menu, whose is_valid is false, so check is_valid before using it. When the expression itself has no value, for example an undefined variable, the method does nothing and the variable keeps any earlier value. May use liquid filters.

Fetches a single {{ menu }}.

Example Fetch and display menu itemsFetch menu items (e.g. from a datastore or menu object) and output them in a list or nav.
Liquid
{%- menu var mainMenu = "Main" -%}
{%- for item in mainMenu.items -%}
	<a href="{{item.href}}">{{item.title}}</a>
{%- endfor -%}

{% menu_item %}

{% menu_item output_to_template? [[var, set, or assign]? variable_name]? output_to_template? = value %}
Parameters
output_to_template optionalflag
Include this flag to write the menu_item's output into the page at this point. What that output is differs by type, and for most types it is a built-in default that may change at any time, so see the output property of the menu_item object before relying on it. The flag may come before or after the variable name. When the call names no variable, the output is written whether or not the flag is present, which makes {% menu_item = value %} the smallest valid use of this method. When the call names a variable, the flag saves the menu_item to the variable and writes its output as well.
var, set, or assign optionalkeyword
Chooses the scope that holds the variable. var, the default, stores it in the current scope. set and assign can store it in outer scopes; Variable Scopes compares the three and when each fits.
variable_name optionalvariable
The variable that receives the menu_item. It may also be written as a reference, &name, which reads the variable's name from another variable (see Methods Overview). Leave it out to write the menu_item to the template instead.
value requiredexpression
Required; without a value the method call is not valid. Identifies which menu_item to fetch. It can evaluate to the menu_item itself, to its GUID, or to other text that identifies it, which for most types is its name; a type identified some other way, or only by GUID, says so in its summary. Names are matched without regard to case, but accented letters must match. A GUID identifies exactly one record, whereas when several records share a name, which of them is returned is not specified, so giving the records you fetch by name unique names avoids the question. A name reads better in a template and a GUID is exact; neither suits every site. When nothing matches, no error is raised: the variable holds an invalid menu_item, whose is_valid is false, so check is_valid before using it. When the expression itself has no value, for example an undefined variable, the method does nothing and the variable keeps any earlier value. May use liquid filters.

Fetches a single {{ menu_item }}.

{% profile %}

Identifies the profile by its profile ID rather than a name. IDs are matched without regard to case.

{% profile output_to_template? [[var, set, or assign]? variable_name]? output_to_template? = value %}
Parameters
output_to_template optionalflag
Include this flag to write the profile's output into the page at this point. What that output is differs by type, and for most types it is a built-in default that may change at any time, so see the output property of the profile object before relying on it. The flag may come before or after the variable name. When the call names no variable, the output is written whether or not the flag is present, which makes {% profile = value %} the smallest valid use of this method. When the call names a variable, the flag saves the profile to the variable and writes its output as well.
var, set, or assign optionalkeyword
Chooses the scope that holds the variable. var, the default, stores it in the current scope. set and assign can store it in outer scopes; Variable Scopes compares the three and when each fits.
variable_name optionalvariable
The variable that receives the profile. It may also be written as a reference, &name, which reads the variable's name from another variable (see Methods Overview). Leave it out to write the profile to the template instead.
value requiredexpression
Required; without a value the method call is not valid. Identifies which profile to fetch. It can evaluate to the profile itself, to its GUID, or to other text that identifies it, which for most types is its name; a type identified some other way, or only by GUID, says so in its summary. Names are matched without regard to case, but accented letters must match. A GUID identifies exactly one record, whereas when several records share a name, which of them is returned is not specified, so giving the records you fetch by name unique names avoids the question. A name reads better in a template and a GUID is exact; neither suits every site. When nothing matches, no error is raised: the variable holds an invalid profile, whose is_valid is false, so check is_valid before using it. When the expression itself has no value, for example an undefined variable, the method does nothing and the variable keeps any earlier value. May use liquid filters.

Fetches a single {{ profile }}.

{% snippet %}

{% snippet output_to_template? [[var, set, or assign]? variable_name]? output_to_template? = value %}
Parameters
output_to_template optionalflag
Include this flag to write the snippet's output into the page at this point. What that output is differs by type, and for most types it is a built-in default that may change at any time, so see the output property of the snippet object before relying on it. The flag may come before or after the variable name. When the call names no variable, the output is written whether or not the flag is present, which makes {% snippet = value %} the smallest valid use of this method. When the call names a variable, the flag saves the snippet to the variable and writes its output as well.
var, set, or assign optionalkeyword
Chooses the scope that holds the variable. var, the default, stores it in the current scope. set and assign can store it in outer scopes; Variable Scopes compares the three and when each fits.
variable_name optionalvariable
The variable that receives the snippet. It may also be written as a reference, &name, which reads the variable's name from another variable (see Methods Overview). Leave it out to write the snippet to the template instead.
value requiredexpression
Required; without a value the method call is not valid. Identifies which snippet to fetch. It can evaluate to the snippet itself, to its GUID, or to other text that identifies it, which for most types is its name; a type identified some other way, or only by GUID, says so in its summary. Names are matched without regard to case, but accented letters must match. A GUID identifies exactly one record, whereas when several records share a name, which of them is returned is not specified, so giving the records you fetch by name unique names avoids the question. A name reads better in a template and a GUID is exact; neither suits every site. When nothing matches, no error is raised: the variable holds an invalid snippet, whose is_valid is false, so check is_valid before using it. When the expression itself has no value, for example an undefined variable, the method does nothing and the variable keeps any earlier value. May use liquid filters.

Fetches a single {{ snippet }}.

{% stylesheet %}

Identifies the stylesheet by its path and name. The path can be absolute (it begins with /, so it is taken from the root) or relative (it is resolved against the folder of the template being rendered, and .. moves up one folder; ./ is not supported). The name is matched as stored, with no extension added or removed. {% include %} gives the full rules, which are the same here.

{% stylesheet output_to_template? [[var, set, or assign]? variable_name]? output_to_template? = value %}
Parameters
output_to_template optionalflag
Include this flag to write the stylesheet's output into the page at this point. What that output is differs by type, and for most types it is a built-in default that may change at any time, so see the output property of the stylesheet object before relying on it. The flag may come before or after the variable name. When the call names no variable, the output is written whether or not the flag is present, which makes {% stylesheet = value %} the smallest valid use of this method. When the call names a variable, the flag saves the stylesheet to the variable and writes its output as well.
var, set, or assign optionalkeyword
Chooses the scope that holds the variable. var, the default, stores it in the current scope. set and assign can store it in outer scopes; Variable Scopes compares the three and when each fits.
variable_name optionalvariable
The variable that receives the stylesheet. It may also be written as a reference, &name, which reads the variable's name from another variable (see Methods Overview). Leave it out to write the stylesheet to the template instead.
value requiredexpression
Required; without a value the method call is not valid. Identifies which stylesheet to fetch. It can evaluate to the stylesheet itself, to its GUID, or to other text that identifies it, which for most types is its name; a type identified some other way, or only by GUID, says so in its summary. Names are matched without regard to case, but accented letters must match. A GUID identifies exactly one record, whereas when several records share a name, which of them is returned is not specified, so giving the records you fetch by name unique names avoids the question. A name reads better in a template and a GUID is exact; neither suits every site. When nothing matches, no error is raised: the variable holds an invalid stylesheet, whose is_valid is false, so check is_valid before using it. When the expression itself has no value, for example an undefined variable, the method does nothing and the variable keeps any earlier value. May use liquid filters.

Fetches a single {{ stylesheet }}.

{% tag %}

{% tag output_to_template? [[var, set, or assign]? variable_name]? output_to_template? = value %}
Parameters
output_to_template optionalflag
Include this flag to write the tag's output into the page at this point. What that output is differs by type, and for most types it is a built-in default that may change at any time, so see the output property of the tag object before relying on it. The flag may come before or after the variable name. When the call names no variable, the output is written whether or not the flag is present, which makes {% tag = value %} the smallest valid use of this method. When the call names a variable, the flag saves the tag to the variable and writes its output as well.
var, set, or assign optionalkeyword
Chooses the scope that holds the variable. var, the default, stores it in the current scope. set and assign can store it in outer scopes; Variable Scopes compares the three and when each fits.
variable_name optionalvariable
The variable that receives the tag. It may also be written as a reference, &name, which reads the variable's name from another variable (see Methods Overview). Leave it out to write the tag to the template instead.
value requiredexpression
Required; without a value the method call is not valid. Identifies which tag to fetch. It can evaluate to the tag itself, to its GUID, or to other text that identifies it, which for most types is its name; a type identified some other way, or only by GUID, says so in its summary. Names are matched without regard to case, but accented letters must match. A GUID identifies exactly one record, whereas when several records share a name, which of them is returned is not specified, so giving the records you fetch by name unique names avoids the question. A name reads better in a template and a GUID is exact; neither suits every site. When nothing matches, no error is raised: the variable holds an invalid tag, whose is_valid is false, so check is_valid before using it. When the expression itself has no value, for example an undefined variable, the method does nothing and the variable keeps any earlier value. May use liquid filters.

Fetches a single {{ tag }}.

{% template %}

Identifies the template by its path and name. The path can be absolute (it begins with /, so it is taken from the root) or relative (it is resolved against the folder of the template being rendered, and .. moves up one folder; ./ is not supported). The name is matched as stored, with no extension added or removed. {% include %} gives the full rules, which are the same here.

{% template output_to_template? [[var, set, or assign]? variable_name]? output_to_template? = value %}
Parameters
output_to_template optionalflag
Include this flag to write the template's output into the page at this point. What that output is differs by type, and for most types it is a built-in default that may change at any time, so see the output property of the template object before relying on it. The flag may come before or after the variable name. When the call names no variable, the output is written whether or not the flag is present, which makes {% template = value %} the smallest valid use of this method. When the call names a variable, the flag saves the template to the variable and writes its output as well.
var, set, or assign optionalkeyword
Chooses the scope that holds the variable. var, the default, stores it in the current scope. set and assign can store it in outer scopes; Variable Scopes compares the three and when each fits.
variable_name optionalvariable
The variable that receives the template. It may also be written as a reference, &name, which reads the variable's name from another variable (see Methods Overview). Leave it out to write the template to the template instead.
value requiredexpression
Required; without a value the method call is not valid. Identifies which template to fetch. It can evaluate to the template itself, to its GUID, or to other text that identifies it, which for most types is its name; a type identified some other way, or only by GUID, says so in its summary. Names are matched without regard to case, but accented letters must match. A GUID identifies exactly one record, whereas when several records share a name, which of them is returned is not specified, so giving the records you fetch by name unique names avoids the question. A name reads better in a template and a GUID is exact; neither suits every site. When nothing matches, no error is raised: the variable holds an invalid template, whose is_valid is false, so check is_valid before using it. When the expression itself has no value, for example an undefined variable, the method does nothing and the variable keeps any earlier value. May use liquid filters.

Fetches a single {{ template }}.

Example Include a template whose name is in a variableDemonstrates multple ways to dynamically include a template. Note that in all of these examples, the template fields will NOT be compiled in the page definition.

Dynamically Include a Template from a Variable

Liquid
{%- var dynamicTemplate = "/partials/footer-main.liquid" -%}
{%- include dynamicTemplate -%}

Dynamically Include Template from a Select List

Liquid
{%- if page.page_layout.is_valid -%}
	<div class="sidebar-{{ page.page_layout.value }}">
		{%- var includeTemplate = "/theme/sidebar/" | append:page.page_layout.value -%}
		{%- include includeTemplate -%}
	</div>
{%- endif -%}

Assuming that page_layout is a select field or similar, this code dynamically creates the name of the template to include based on the selected value.

Dynamically Include Multiple Templates from a TemplateList Field

Liquid
{%- if page.sidebar_sections.count > 0 -%}
	{%- for section in page.sidebar_sections.selected -%}
		{%- include section -%}
	{%- endfor -%}
{%- endif -%}

Assuming that sidebar_sections is a templatelist field or similar, this code dynamically includes each of the selected templates.

Check if a dynamic template exists before including it

Liquid
{%- template var dynamicTemplate = "/theme/sidebar/" | append: page.sidebar_section.value | append: ".liquid" -%}
{%- if dynamicTemplate.is_valid -%}
	{%- include dynamicTemplate -%}
{%- endif -%}

Assuming that sidebar_sections is a templatelist field or similar, this code dynamically includes each of the selected templates.