Shopify/Liquid Object Syntax

How to get an object value on a template file

5217a53eb06396a4f9289ae6941cef62

Written By Guilherme de Andrade Arantes (Administrator)

Updated at October 20th, 2017

In order to display the object value, you'll need to make sure it's inside the brackets markup as the following example:

<h1>{{ question.name }}</h1>

This would output "Shopify/Liquid Object Syntax" on this specific page.


Wrong Syntax:

<h1>{% question.name %}</h1>
<h1>{{ question.name </h1>}}

The above examples wouldn't work and no output would be displayed.


Real Liquid Example

This example is from a Standard Helpjuice Theme live on our Theme Library:

<article class="main_content">
  <h1 class="page_title">{{ question.name }}</h1>

  <p class="page_description">
    {{ question.description }}
  </p>

  <div class="page_content">
    {{ question.answers.first.cleaned_body }}
  </div>
</article>


Liquid Filters

You can apply filters on the Liquid Statements. Every time you need to limit a loop statement or change the output of an object value, you can rely on Liquid Filters. Check the Shopify/Liquid Filter Syntax article.‍


Objects List:

You can find the complete object reference at Shopify/Liquid Complete Objects Reference

Was this article helpful?