Skip to content
On this page · 20 sections
  1. Available on every page
  2. site
  3. request
  4. locale
  5. localization
  6. settings
  7. routes
  8. theme
  9. Page SEO values
  10. consent
  11. Menus
  12. Data lists and entries
  13. data_lists
  14. data_list
  15. entry
  16. route
  17. Images and videos
  18. Search
  19. Sections and blocks
  20. Forms
Docs

Liquid objects

Updated

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 %}
id number
The website's id.
name string
The website's name.
email string
The contact email from your settings.
phone, address string
Contact details, when set.
url string
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 your in1s.com address (see Custom domains). In a preview you open from the panel, it is the address of that preview.
domain string
The host of site.url, for example example.com.
permanent_domain string
Your website's in1s.com address, for example yoursite.in1s.com. It does not change when you connect a custom domain.
description string
The website's SEO description.
locale locale
The language of the current page (see locale).
published_locales list of locale
Every language of the website.
social object
Social media links.
type string
The website type you chose in website settings, for example mobile_app or local_business.
profile object
The website's profile fields. Which fields exist depends on site.type.
currency, money_format string
The currency code and money format, used by the money filter.
password_message string
The message shown on the password page while the site is password protected.

request

path string
The current path, with its leading / (/ on the home page).
query object
The query parameters, for example request.query.sort.
query_string string
The raw query string.
host, origin string
The host name, and scheme://host.
locale locale
The visitor's language.
page_type string
The kind of page, for example index, entry or data-list.
design_mode boolean
true when the page is shown in the theme editor.
private_preview boolean
true when 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_title string
The page's title as typed in its SEO settings.
page_description string
The page's meta description; empty when it has none, so fall back to site.description.
page_image string
The page's social sharing image, else the website's.
canonical_url string
The page's full canonical URL.
page_noindex boolean
true when the page's owner chose to hide it from search engines. Print <meta name="robots" content="noindex, follow"> for it.

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.

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, url string
The list's name, handle and listing URL.
entries list of entry
The entries of the current page, filtered and sorted as the visitor asked.
entries_count number
How many entries match the current filters.
current_page, total_pages, page_size number
Paging. Pages are read from ?page=.
fields list
The list's fields in order, each with id, label and type.
filters list
A filter per field marked filterable, each with label and options (label, url, active, count).
sort_options list
The sorts offered (value, direction, label_key, field_label); active_sort and active_direction are the ones applied.
listing_query, filter_query string
The current sort and filters as a query string, to keep them in your own links.
seo_title, seo_description string
The list's SEO values.
feed_url string
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 date filter.
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.

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.

Start typing to search the docs.