Liquid objects

Liquid objects contain attributes to output dynamic content on the page. For example, the product object contains an attribute called title that can be used to output the title of a product.

Liquid objects are also often referred to as Liquid variables.

To output an object's attribute, wrap the object's name in {{ and }}, as shown below:

{{ product.title }} <!-- Output: “Awesome Shoes” -->

On this page

Global objects

The following objects can be used and accessed from any file in your theme, and are defined as global objects, or global variables:

cart

The cart object returns your site's cart. More info ›

account

The account object returns the account that is logged in to the site. It will not return anything if a account isn't logged in. More info ›

{% if account %}
  <a href="/account">My Account</a>
  {{ 'Log out' | account_logout_link }}
{% else %}
  {{ 'Log in' | account_login_link }}
  {{ 'Create an account' | account_register_link }}
{% endif %}

linklists

The linklists object returns the set of the menus and links in your site. You can access a menu by calling its handle on the linklists object. More info ›

<ul>
 {% for link in linklists.categories.links %}
    <li>{{ link.title | link_to: link.url }}</li>
  {% endfor %}
</ul>

site

The site object contains information about your site. More info ›

page_title

The page_title object returns the title of the current page. More info ›

settings

The settings object lets you access the settings of a site's published theme. More info ›

{% if settings.logo %}
  {{ settings.logo | img_url | img_tag: site.name }}
{% else %}
  <span class="no-logo">{{ site.name }}</span>
{% endif %}

error

The error object returns the error for the current page (if any). More info ›

Content objects

The following objects are used to output the content of template and section files, as well as the scripts and stylesheets loaded by Givecloud.

content_for_header

The content_for_header object is required in theme.liquid. It must be placed inside the HTML <head> tag. It dynamically loads all assets required by Givecloud into the document head. These include assets imported with the asset tag, and assets required for Givecloud apps.

content_for_layout

The content_for_layout object is required in theme.liquid. It must be placed inside the HTML <body> tag. It dynamically loads content generated by other templates such as index.liquid or product.liquid.

content_for_footer

The content_for_footer object is required in theme.liquid. It must be placed near the HTML <body> closing tag. It dynamically loads all scripts required by Givecloud into the bottom of the body. These include assets imported with the asset tag, and assets required for Givecloud apps.