Liquid Objects

Last updated on June 18, 2024

Liquid objects represent or are often referred to as variables that you can use to build your theme. Examples of Object types include:

  • Resources
  • Standard Insites content
  • Functional elements that help build interactivity.

Objects might represent a single data point or contain multiple properties. Some properties might represent a related object, such as a product in a category or collection of products.

We cover the following most commonly-used objects on Insites, namely:

  • forloop
  • tablerowloop

forloop

This section discusses the following usage examples of the forloop object:

  • forloop.first
  • forloop.index
  • forloop.index0
  • forloop.last
  • forloop.length
  • forloop.rindex
  • forloop.rindex0

forloop.first

Returns true if it's the first iteration of the loop. Returns false if it is not the first iteration.

Input

Output

forloop.index

Returns the current index of the loop, starting at 1.

Input

Output

forloop.index0

Returns the current index of the loop, starting at 0.

Input

Output

forloop.last

Returns true if it's the last iteration of the loop. Returns false if it is not the last iteration.

Input

Output

forloop.length

Returns the number of iterations of the loop.

Input

Output

forloop.rindex

Returns in reverse order.

Input

Output

forloop.rindex0

Returns in reverse order.

Input

Output

tablerowloop

The tablerow object is used within the tag. It contains attributes of its parent loop. This section discusses the following examples:

  • tablerowloop.length
  • tablerowloop.index
  • tablerowloop.index0
  • tablerowloop.rindex
  • tablerowloop.rindex0
  • tablerowloop.first
  • tablerowloop.last
  • tablerowloop.col
  • tablerowloop.col0
  • tablerowloop.col_first
  • tablerowloop.col_last

tablerowloop.length

Returns the number of iterations of the loop.

tablerowloop.index

Returns the current index of the loop, starting at 1.

tablerowloop.index0

Returns the current index of the loop, starting at 0.

tablerowloop.rindex

Returns in reverse order.

tablerowloop.rindex0

Returns in reverse order.

tablerowloop.first

Returns if it's the first iteration of the loop. Returns if it is not the first iteration.

tablerowloop.last

Returns if it's the last iteration of the loop. Returns if it is not the last iteration.

tablerowloop.col

Returns the index of the current row, starting at 1.

tablerowloop.col0

Returns the index of the current row, starting at 0.

tablerowloop.col_first

Returns if the current column is the first column in a row, returns if it is not.

tablerowloop.col_last

Returns if the current column is the last column in a row, returns if it is not.

Note

This topic is a compilation of knowledge found at Shopify Themes, Liquid Documentation, Liquid Gem Documentation, and Liquid for Designers.

Have a suggestion for this page?

Didn't quite find what you are looking for or have feedback on how we can make the content better then we would love to hear from you. Please provide us feedback and we will get back to you shortly.