Skip to documentation content

Content methods

Content methods

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

{% article %}

{% article output_to_template? [[var, set, or assign]? variable]? output_to_template? = value %}
Parameters
output_to_template optionalflag
If included the {% article %} will be output directly to the template.
var, set, or assign optionalkeyword
Optional. Specify either "var", "set" or "assign" to change which scope this {% article %} is stored on. "var" is the default behavior.
variable_name optionalvariable
Specify a variable name in order to save this article to a variable. If not specified, it will be output to the template instead.
value requiredexpression
Should evaluate to an object of type article, or the name or guid of one. May use liquid filters.

Fetches a single {{ article }}.

{% author %}

{% author output_to_template? [[var, set, or assign]? variable]? output_to_template? = value %}
Parameters
output_to_template optionalflag
If included the {% author %} will be output directly to the template.
var, set, or assign optionalkeyword
Optional. Specify either "var", "set" or "assign" to change which scope this {% author %} is stored on. "var" is the default behavior.
variable_name optionalvariable
Specify a variable name in order to save this author to a variable. If not specified, it will be output to the template instead.
value requiredexpression
Should evaluate to an object of type author, or the name or guid of one. May use liquid filters.

Fetches a single {{ author }}.

{% blog %}

{% blog output_to_template? [[var, set, or assign]? variable]? output_to_template? = value %}
Parameters
output_to_template optionalflag
If included the {% blog %} will be output directly to the template.
var, set, or assign optionalkeyword
Optional. Specify either "var", "set" or "assign" to change which scope this {% blog %} is stored on. "var" is the default behavior.
variable_name optionalvariable
Specify a variable name in order to save this blog to a variable. If not specified, it will be output to the template instead.
value requiredexpression
Should evaluate to an object of type blog, or the name or guid of one. May use liquid filters.

Fetches a single {{ blog }}.

{% blog_post %}

{% blog_post output_to_template? [[var, set, or assign]? variable]? output_to_template? = value %}
Parameters
output_to_template optionalflag
If included the {% blog_post %} will be output directly to the template.
var, set, or assign optionalkeyword
Optional. Specify either "var", "set" or "assign" to change which scope this {% blog_post %} is stored on. "var" is the default behavior.
variable_name optionalvariable
Specify a variable name in order to save this blog_post to a variable. If not specified, it will be output to the template instead.
value requiredexpression
Should evaluate to an object of type blog_post, or the name or guid of one. May use liquid filters.

Fetches a single {{ blog_post }}.

{% calendar %}

{% calendar output_to_template? [[var, set, or assign]? variable]? output_to_template? = value %}
Parameters
output_to_template optionalflag
If included the {% calendar %} will be output directly to the template.
var, set, or assign optionalkeyword
Optional. Specify either "var", "set" or "assign" to change which scope this {% calendar %} is stored on. "var" is the default behavior.
variable_name optionalvariable
Specify a variable name in order to save this calendar to a variable. If not specified, it will be output to the template instead.
value requiredexpression
Should evaluate to an object of type calendar, or the name or guid of one. May use liquid filters.

Fetches a single {{ calendar }}.

{% calendar_entry %}

{% calendar_entry output_to_template? [[var, set, or assign]? variable]? output_to_template? = value %}
Parameters
output_to_template optionalflag
If included the {% calendar_entry %} will be output directly to the template.
var, set, or assign optionalkeyword
Optional. Specify either "var", "set" or "assign" to change which scope this {% calendar_entry %} is stored on. "var" is the default behavior.
variable_name optionalvariable
Specify a variable name in order to save this calendar_entry to a variable. If not specified, it will be output to the template instead.
value requiredexpression
Should evaluate to an object of type calendar_entry, or the name or guid of one. May use liquid filters.

Fetches a single {{ calendar_entry }}.

{% datastore %}

{% datastore output_to_template? [[var, set, or assign]? variable]? output_to_template? = value %}
Parameters
output_to_template optionalflag
If included the {% datastore %} will be output directly to the template.
var, set, or assign optionalkeyword
Optional. Specify either "var", "set" or "assign" to change which scope this {% datastore %} is stored on. "var" is the default behavior.
variable_name optionalvariable
Specify a variable name in order to save this datastore to a variable. If not specified, it will be output to the template instead.
value requiredexpression
Should evaluate to an object of type datastore, or the name or guid of one. May use liquid filters.

Fetches a single {{ datastore }}.

{% datastore_item %}

{% datastore_item output_to_template? [[var, set, or assign]? variable]? output_to_template? = value %}
Parameters
output_to_template optionalflag
If included the {% datastore_item %} will be output directly to the template.
var, set, or assign optionalkeyword
Optional. Specify either "var", "set" or "assign" to change which scope this {% datastore_item %} is stored on. "var" is the default behavior.
variable_name optionalvariable
Specify a variable name in order to save this datastore_item to a variable. If not specified, it will be output to the template instead.
value requiredexpression
Should evaluate to an object of type datastore_item, or the name or guid of one. May use liquid filters.

Fetches a single {{ datastore_item }}.

{% document %}

{% document output_to_template? [[var, set, or assign]? variable]? output_to_template? = value %}
Parameters
output_to_template optionalflag
If included the {% document %} will be output directly to the template.
var, set, or assign optionalkeyword
Optional. Specify either "var", "set" or "assign" to change which scope this {% document %} is stored on. "var" is the default behavior.
variable_name optionalvariable
Specify a variable name in order to save this document to a variable. If not specified, it will be output to the template instead.
value requiredexpression
Should evaluate to an object of type document, or the name or guid of one. May use liquid filters.

Fetches a single {{ document }}.

{% error_page %}

{% error_page output_to_template? [[var, set, or assign]? variable]? output_to_template? = value %}
Parameters
output_to_template optionalflag
If included the {% error_page %} will be output directly to the template.
var, set, or assign optionalkeyword
Optional. Specify either "var", "set" or "assign" to change which scope this {% error_page %} is stored on. "var" is the default behavior.
variable_name optionalvariable
Specify a variable name in order to save this error_page to a variable. If not specified, it will be output to the template instead.
value requiredexpression
Should evaluate to an object of type error_page, or the name or guid of one. May use liquid filters.

Fetches a single {{ error_page }}.

{% folder %}

{% folder output_to_template? [[var, set, or assign]? variable]? output_to_template? = value %}
Parameters
output_to_template optionalflag
If included the {% folder %} will be output directly to the template.
var, set, or assign optionalkeyword
Optional. Specify either "var", "set" or "assign" to change which scope this {% folder %} is stored on. "var" is the default behavior.
variable_name optionalvariable
Specify a variable name in order to save this folder to a variable. If not specified, it will be output to the template instead.
value requiredexpression
Should evaluate to an object of type folder, or the name or guid of one. May use liquid filters.

Fetches a single {{ folder }}.

{% form %}

{% form output_to_template? [[var, set, or assign]? variable]? output_to_template? = value %}
Parameters
output_to_template optionalflag
If included the {% form %} will be output directly to the template.
var, set, or assign optionalkeyword
Optional. Specify either "var", "set" or "assign" to change which scope this {% form %} is stored on. "var" is the default behavior.
variable_name optionalvariable
Specify a variable name in order to save this form to a variable. If not specified, it will be output to the template instead.
value requiredexpression
Should evaluate to an object of type form, or the name or guid of one. May use liquid filters.

Fetches a single {{ form }}.

{% form_submit %}

{% form_submit output_to_template? [[var, set, or assign]? variable]? output_to_template? = value %}
Parameters
output_to_template optionalflag
If included the {% form_submit %} will be output directly to the template.
var, set, or assign optionalkeyword
Optional. Specify either "var", "set" or "assign" to change which scope this {% form_submit %} is stored on. "var" is the default behavior.
variable_name optionalvariable
Specify a variable name in order to save this form_submit to a variable. If not specified, it will be output to the template instead.
value requiredexpression
Should evaluate to an object of type form_submit, or the name or guid of one. May use liquid filters.

Fetches a single {{ form_submit }}.

{% gallery %}

{% gallery output_to_template? [[var, set, or assign]? variable]? output_to_template? = value %}
Parameters
output_to_template optionalflag
If included the {% gallery %} will be output directly to the template.
var, set, or assign optionalkeyword
Optional. Specify either "var", "set" or "assign" to change which scope this {% gallery %} is stored on. "var" is the default behavior.
variable_name optionalvariable
Specify a variable name in order to save this gallery to a variable. If not specified, it will be output to the template instead.
value requiredexpression
Should evaluate to an object of type gallery, or the name or guid of one. May use liquid filters.

Fetches a single {{ gallery }}.

{% image %}

{% image output_to_template? [[var, set, or assign]? variable]? output_to_template? = value %}
Parameters
output_to_template optionalflag
If included the {% image %} will be output directly to the template.
var, set, or assign optionalkeyword
Optional. Specify either "var", "set" or "assign" to change which scope this {% image %} is stored on. "var" is the default behavior.
variable_name optionalvariable
Specify a variable name in order to save this image to a variable. If not specified, it will be output to the template instead.
value requiredexpression
Should evaluate to an object of type image, or the name or guid of one. 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 %}

{% image_preset output_to_template? [[var, set, or assign]? variable]? output_to_template? = value %}
Parameters
output_to_template optionalflag
If included the {% image_preset %} will be output directly to the template.
var, set, or assign optionalkeyword
Optional. Specify either "var", "set" or "assign" to change which scope this {% image_preset %} is stored on. "var" is the default behavior.
variable_name optionalvariable
Specify a variable name in order to save this image_preset to a variable. If not specified, it will be output to the template instead.
value requiredexpression
Should evaluate to an object of type image_preset, or the name or guid of one. May use liquid filters.

Fetches a single {{ image_preset }}.

{% javascript %}

{% javascript output_to_template? [[var, set, or assign]? variable]? output_to_template? = value %}
Parameters
output_to_template optionalflag
If included the {% javascript %} will be output directly to the template.
var, set, or assign optionalkeyword
Optional. Specify either "var", "set" or "assign" to change which scope this {% javascript %} is stored on. "var" is the default behavior.
variable_name optionalvariable
Specify a variable name in order to save this javascript to a variable. If not specified, it will be output to the template instead.
value requiredexpression
Should evaluate to an object of type javascript, or the name or guid of one. 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]? output_to_template? = value %}
Parameters
output_to_template optionalflag
If included the {% menu %} will be output directly to the template.
var, set, or assign optionalkeyword
Optional. Specify either "var", "set" or "assign" to change which scope this {% menu %} is stored on. "var" is the default behavior.
variable_name optionalvariable
Specify a variable name in order to save this menu to a variable. If not specified, it will be output to the template instead.
value requiredexpression
Should evaluate to an object of type menu, or the name or guid of one. 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]? output_to_template? = value %}
Parameters
output_to_template optionalflag
If included the {% menu_item %} will be output directly to the template.
var, set, or assign optionalkeyword
Optional. Specify either "var", "set" or "assign" to change which scope this {% menu_item %} is stored on. "var" is the default behavior.
variable_name optionalvariable
Specify a variable name in order to save this menu_item to a variable. If not specified, it will be output to the template instead.
value requiredexpression
Should evaluate to an object of type menu_item, or the name or guid of one. May use liquid filters.

Fetches a single {{ menu_item }}.

{% profile %}

{% profile output_to_template? [[var, set, or assign]? variable]? output_to_template? = value %}
Parameters
output_to_template optionalflag
If included the {% profile %} will be output directly to the template.
var, set, or assign optionalkeyword
Optional. Specify either "var", "set" or "assign" to change which scope this {% profile %} is stored on. "var" is the default behavior.
variable_name optionalvariable
Specify a variable name in order to save this profile to a variable. If not specified, it will be output to the template instead.
value requiredexpression
Should evaluate to an object of type profile, or the name or guid of one. May use liquid filters.

Fetches a single {{ profile }}.

{% snippet %}

{% snippet output_to_template? [[var, set, or assign]? variable]? output_to_template? = value %}
Parameters
output_to_template optionalflag
If included the {% snippet %} will be output directly to the template.
var, set, or assign optionalkeyword
Optional. Specify either "var", "set" or "assign" to change which scope this {% snippet %} is stored on. "var" is the default behavior.
variable_name optionalvariable
Specify a variable name in order to save this snippet to a variable. If not specified, it will be output to the template instead.
value requiredexpression
Should evaluate to an object of type snippet, or the name or guid of one. May use liquid filters.

Fetches a single {{ snippet }}.

{% stylesheet %}

{% stylesheet output_to_template? [[var, set, or assign]? variable]? output_to_template? = value %}
Parameters
output_to_template optionalflag
If included the {% stylesheet %} will be output directly to the template.
var, set, or assign optionalkeyword
Optional. Specify either "var", "set" or "assign" to change which scope this {% stylesheet %} is stored on. "var" is the default behavior.
variable_name optionalvariable
Specify a variable name in order to save this stylesheet to a variable. If not specified, it will be output to the template instead.
value requiredexpression
Should evaluate to an object of type stylesheet, or the name or guid of one. May use liquid filters.

Fetches a single {{ stylesheet }}.

{% tag %}

{% tag output_to_template? [[var, set, or assign]? variable]? output_to_template? = value %}
Parameters
output_to_template optionalflag
If included the {% tag %} will be output directly to the template.
var, set, or assign optionalkeyword
Optional. Specify either "var", "set" or "assign" to change which scope this {% tag %} is stored on. "var" is the default behavior.
variable_name optionalvariable
Specify a variable name in order to save this tag to a variable. If not specified, it will be output to the template instead.
value requiredexpression
Should evaluate to an object of type tag, or the name or guid of one. May use liquid filters.

Fetches a single {{ tag }}.

{% template %}

{% template output_to_template? [[var, set, or assign]? variable]? output_to_template? = value %}
Parameters
output_to_template optionalflag
If included the {% template %} will be output directly to the template.
var, set, or assign optionalkeyword
Optional. Specify either "var", "set" or "assign" to change which scope this {% template %} is stored on. "var" is the default behavior.
variable_name optionalvariable
Specify a variable name in order to save this template to a variable. If not specified, it will be output to the template instead.
value requiredexpression
Should evaluate to an object of type template, or the name or guid of one. 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.