Liquid objects
The objects a theme can read in Liquid, such as site, request, settings, data lists and entries, menus, routes, forms and search, with their main properties.
Objects are the data a theme reads: {{ site.name }}, {% for link in linklists['main-menu'].links %}. Some are
available on every page, others only on certain pages or inside certain tags. This page lists the objects and the
properties you will use most.
Note
Liquid prints values as they are stored and does not escape them for you. Escape text with | escape when you
print it in HTML or an attribute, and always for anything a visitor typed, such as search.terms and
form.session values.
Available on every page
| Object | What it is |
|---|---|
site (also shop) |
Your website: name, address, languages, contact details, profile |
request |
The current request: path, query, language, editor state |
settings |
The theme's global settings |
localization |
Languages for a language switcher |
linklists (also menus) |
Your menus, by handle |
data_lists |
Every data list, by handle |
routes |
Platform URLs such as the search page |
theme |
The theme being rendered |
template |
The name of the current template, for example index or entry.posts |
page_title, page_description, page_image, canonical_url, page_noindex |
The page's SEO values |
content_for_header, content_for_layout |
What the layout must print (see Theme structure) |
consent |
The cookie banner, when it is on |
site
<a href="{{ routes.root_url }}">{{ site.name | escape }}</a>
{% if site.phone != blank %}<a href="tel:{{ site.phone | escape }}">{{ site.phone | escape }}</a>{% endif %}
idnumber- The website's id.
namestring- The website's name.
emailstring- The contact email from your settings.
phone,addressstring- Contact details, when set.
urlstring- The website's main address, with no trailing slash, for example
https://example.com. It is the address your canonical links and sitemap use: your newest secure custom domain, else yourin1s.comaddress (see Custom domains). In a preview you open from the panel, it is the address of that preview. domainstring- The host of
site.url, for exampleexample.com. permanent_domainstring- Your website's
in1s.comaddress, for exampleyoursite.in1s.com. It does not change when you connect a custom domain. descriptionstring- The website's SEO description.
localelocale- The language of the current page (see locale).
published_localeslist of locale- Every language of the website.
socialobject- Social media links.
typestring- The website type you chose in website settings, for example
mobile_apporlocal_business. profileobject- The website's profile fields. Which fields exist depends on
site.type. currency,money_formatstring- The currency code and money format, used by the
moneyfilter. password_messagestring- The message shown on the password page while the site is password protected.
request
pathstring- The current path, with its leading
/(/on the home page). queryobject- The query parameters, for example
request.query.sort. query_stringstring- The raw query string.
host,originstring- The host name, and
scheme://host. localelocale- The visitor's language.
page_typestring- The kind of page, for example
index,entryordata-list. design_modebooleantruewhen the page is shown in the theme editor.private_previewbooleantruewhen the page was opened from a private preview link.
locale
A language object, as request.locale, site.locale and each item of site.published_locales and
localization.available_languages.
| Property | Example |
|---|---|
iso_code |
en, ar |
name |
Arabic |
endonym_name |
العربية |
primary |
true for the website's default language |
root_url |
/ for the default language, /ar for another |
text_direction |
rtl or ltr |
text_direction is an in1s addition; Shopify has no such property.
<html lang="{{ request.locale.iso_code }}" dir="{{ request.locale.text_direction | default: 'ltr' }}">
localization
localization.language is the current language and localization.available_languages the website's languages.
Use them with {% form 'localization' %} to build a language switcher (see Liquid tags).
settings
Every global setting from config/settings_schema.json, by its id: {{ settings.radius }}. Picker settings come back
as objects: a font_picker as a font, a colour scheme group as a list of schemes, an image_picker as an image.
See Theme settings and translations.
routes
root_url, search_url, predictive_search_url and password_url, each in the visitor's language.
For one of your own pages, use the route_url filter instead: {{ '/about' | route_url }}. A hand-written
href="/about" drops the visitor's language.
theme
id, name (the theme's name on your website) and role (always main).
Page SEO values
page_titlestring- The page's title as typed in its SEO settings.
page_descriptionstring- The page's meta description; empty when it has none, so fall back to
site.description. page_imagestring- The page's social sharing image, else the website's.
canonical_urlstring- The page's full canonical URL.
page_noindexbooleantruewhen the page's owner chose to hide it from search engines. Print<meta name="robots" content="noindex, follow">for it.
consent
When the platform's cookie banner is on: consent.enabled, consent.settings_label (print it with | escape) and
consent.settings_link, a ready link that reopens the banner's settings. Without a link in your footer, the banner
shows a small floating button instead.
Menus
linklists holds your menus by handle.
<nav aria-label="{{ 'general.main_menu' | t }}">
<ul>
{%- for link in linklists['main-menu'].links -%}
<li>
<a href="{{ link.url | escape }}"{% if link.current %} aria-current="page"{% endif %}>{{ link.title | escape }}</a>
{%- if link.links.size > 0 -%}
<ul>{%- for child in link.links -%}<li><a href="{{ child.url | escape }}">{{ child.title | escape }}</a></li>{%- endfor -%}</ul>
{%- endif -%}
</li>
{%- endfor -%}
</ul>
</nav>
A menu has handle, title, links and levels (how deep it goes). A link has title, url, type, links (its
children), levels, active and current (it points to this page), and child_active and child_current (one of
its children does). A link_list setting gives you the same menu object.
Data lists and entries
data_lists
Any data list by its handle: data_lists['posts'] or data_lists.posts.
{%- for post in data_lists['posts'].entries limit: 3 -%}
<a href="{{ post.url }}">{{ post.title | escape }}</a>
{%- endfor -%}
A list reached this way shows all its entries; use {% paginate %} to page it.
data_list
On a listing page, data_list is the list being shown. A data_source setting gives you the same object.
title,handle,urlstring- The list's name, handle and listing URL.
entrieslist of entry- The entries of the current page, filtered and sorted as the visitor asked.
entries_countnumber- How many entries match the current filters.
current_page,total_pages,page_sizenumber- Paging. Pages are read from
?page=. fieldslist- The list's fields in order, each with
id,labelandtype. filterslist- A filter per field marked filterable, each with
labelandoptions(label,url,active,count). sort_optionslist- The sorts offered (
value,direction,label_key,field_label);active_sortandactive_directionare the ones applied. listing_query,filter_querystring- The current sort and filters as a query string, to keep them in your own links.
seo_title,seo_descriptionstring- The list's SEO values.
feed_urlstring- The list's feed address, when its feed is on.
{%- for filter in data_list.filters -%}
<p>{{ filter.label | escape }}</p>
{%- for option in filter.options -%}
<a href="{{ option.url | escape }}"{% if option.active %} aria-current="true"{% endif %}>
{{ option.label | escape }} ({{ option.count }})
</a>
{%- endfor -%}
{%- endfor -%}
entry
On an entry page, entry is the entry being shown. An entry_picker setting and the items of entries are the
same object.
id,title,slug,handle,url- The entry's id, title, slug in the current language, handle and URL.
created_at,updated_at,published_at- Dates, for the
datefilter. seo_title,seo_description- The entry's SEO values.
template_suffix- The alternate template the entry uses, if any.
data_list- The list the entry belongs to.
referenced_by.<handle>- Entries of another list that point to this entry through a reference field, for example
entry.referenced_by.products.
Every field of the list is a property too, by its id: entry.excerpt, or entry[field_id] when the id is in a
variable. Text arrives in the visitor's language, an image field as an image, a reference field as the entry it points
to (or a list of entries when it holds several), and a structure field as a list of rows.
<h1>{{ entry.title | escape }}</h1>
{{ entry.content | field_html: entry, 'content' }}
{%- for f in entry.data_list.fields -%}
{{ entry[f.id] | field_html: entry, f.id }}
{%- endfor -%}
Print fields with field_html (rich text and HTML stay as markup, everything else is escaped) or | escape.
route
On a page you created, route has id, title, path, handle, url, published_at and
template_suffix.
Images and videos
An image (from an image_picker setting or an image field) has src, alt, width, height, aspect_ratio and
focal_point. Print it with the image filters:
{{ section.settings.image | image_url: width: 1200 | image_tag: alt: section.settings.image.alt }}
An uploaded video has sources, preview_image, width, height, duration and alt; print it with media_tag.
See Liquid filters.
Search
On the search page (templates/search.json), search has:
| Property | Meaning |
|---|---|
terms |
What the visitor searched for. Always print it with | escape. |
performed |
true when a search was made |
results |
The entries found, one page at a time |
results_count |
How many results there are in all |
current_page, total_pages, page_size |
Paging (12 results a page by default) |
data_list |
The list the search was narrowed to with ?data_list=, if any |
Sections and blocks
Inside a section file, section is the section being rendered:
| Property | Meaning |
|---|---|
section.id |
The section's key |
section.type |
The section file's name |
section.settings |
Its settings, by id |
section.blocks, section.block_order |
Its visible blocks, and their order |
section.hidden_blocks |
Blocks the owner hid (empty in the editor, where hidden blocks stay visible) |
section.index, section.index0 |
Its position on the page, from 1 or from 0 |
section.in1s_attributes |
The editor attributes; print them on the section's root element |
Inside a block, block has type, settings and in1s_attributes. A block's key is not available.
shopify_attributes is accepted as another name for in1s_attributes. See
Sections and blocks.
Forms
Inside {% form %}, form is the form being rendered: handle, name, fields, submit_label, success_message,
errors, posted_successfully?, submission (the saved submission after a successful post), captcha_required?,
and session when the form keeps a session. Each field has id, type, label, name, html_id, value, error,
required, options, placeholder and info. See Liquid tags.
Warning
form.session values are written by visitors. Treat them as untrusted: | escape for text, | times: 1 for
numbers.