Global variables

These variables can be used and accessed from any file in your theme:

  {% for article in blogs.myblog.articles  %}
   <li>{{ article.title | link_to: article.url }}</li>
  {% endfor %}

The liquid variable "blogs" refers to the blogs in your shop. It is important to note that you cannot iterate over blogs. If you want to complete this action, your best bet is to use a linklist.


The liquid variable "cart" refers to the cart in your shop. To view a complete list of cart attributes click here.

{% for product in collections.frontpage.products %}
  {{ product.title }}
{% endfor %}

The liquid variable "collections" contains a list of all of the collections in a shop.

{% if current_page != 1 %} Page {{ current_page }}{% endif %}

The "current_page" variable returns the number of the page you are on when browsing through paginated content.

<!-- in blog.liquid -->
{% if current_tags %}
  <h1>{{ blog.title | link_to: blog.url }} &raquo; {{ current_tags.first }}</h1>
{% else %}
  <h1>{{ blog.title }}</h1>
{% endif %}

The "current_tags" variable will contain a different list of tags depending on the type of template that is rendered. When the template that is being rendered is a collection template, the current_tags variable will contain all of the tags that are used to filter the product collection. When the template that is being rendered is the blog template, the current_tags variable will contain all of the tags that are used to filter the blog. Tags in the current_tags variable will always display in alphabetical order.

{% if shop.customer_accounts_enabled %}
  {% if customer %}
    <a href="/account">My Account</a> 
    {{ 'Log out' | customer_logout_link }}
  {% else %}
    {{ 'Log in' | customer_login_link }} 
    {% if shop.customer_accounts_optional %}
      {{ 'Create an account' | customer_register_link }}
    {% endif %}
  {% endif %}
{% endif %}

The liquid variable "customer" is only defined when a customer is logged-in to the store.

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

The liquid variable "linklists" contains a collection of all of the links in your shop. You can access a linklist by calling its handle on linklists.

<h1>{{ pages.about.title }}</h1>
<p>{{ }} says...</p>
<div>{{ pages.about.content }}</div>

The liquid variable "pages" refers to all of the pages in your shop.

{% if page_description %}
  <meta name="description" content="{{ page_description }}" /> 
{% endif %}

In Shopify 2, merchants can specify a page_description. That field is automatically populated with the product/collection/article description. If the product/collection/article description does not exist, then page_description will render nothing because {{ shop_description }} will return "false".

{{ page_title }}

The liquid variable {{ page_title }} returns the title of the current page.


The liquid variable "shop" returns information about your shop. To view a list of shop attributes click here.

{% if template contains 'product' %}
{% endif %}

The liquid variable "template" returns the name of the template used to render the current page, with the .liquid extension omitted. As a best practice, it is recommended that you use the template variable as a body class.

{% if settings.use_logo %}
{{ 'logo.png' | asset_url | img_tag: }}
{% else %}
<span class="no-logo">{{ }}</span>
{% endif %}
{% if settings.featured_collection and settings.featured_collection != '' and collections[settings.featured_collection].handle == settings.featured_collection and collections[settings.featured_collection].products_count > 0 %}
{% for product in collections[settings.featured_collection].products %}
  {% include 'product-loop' %}
{% endfor %}
{% endif %}

The liquid variable "settings" gives you access to all of the theme settings.

Go to your <a href="/admin/themes/{{ }}/settings">theme settings</a>.

The liquid variable "theme" represents the currently active theme (in other words, the one which contains the template that's currently being rendered).

We have a beautiful mobile theme, it's called {{ | link_to_theme: "mobile" }}

The liquid variable "themes" provides access to the shop's published themes.

Ready to put what you've learned into action?

Build an online store with Shopify Try it Free

Experience the future of retail now

Shopify Point of Sale Try it Free