Nimbu Developer Docs
Other

Global Variables

Complete reference of all global Liquid variables available in Nimbu themes

Nimbu provides a comprehensive set of global variables (drops) accessible in all Liquid templates.

Site Variables

site

Global site information:

{{ site.name }}                 <!-- Site name -->
{{ site.domain }}               <!-- Primary domain, e.g. www.example.com -->
{{ site.protocol }}             <!-- "https://" -->
{{ site.primary_domain_with_protocol }} <!-- https://www.example.com -->
{{ site.meta_description }}     <!-- Site description -->
{{ site.meta_keywords }}        <!-- Site keywords -->
{{ site.favicon }}              <!-- Favicon URL -->
{{ site.updated_at }}           <!-- Last content change -->
{{ site.env.MY_VARIABLE }}      <!-- Site environment variable -->

site.env exposes the site's environment variables, including those marked secret. Anything you print is public, so only print values meant for the browser.

There is no site.locale: use the global default_locale instead.

Request Variables

params

URL query parameters:

{{ params.page }}               <!-- ?page=2 -->
{{ params.category }}           <!-- ?category=shoes -->
{{ params.q }}                  <!-- ?q=search+term -->

{% if params.filter %}
  <!-- Check parameter exists -->
{% endif %}

path and url

There is no request variable. Use path and the url drop:

{{ path }}                      <!-- Requested path, without query string -->
{{ url.current }}               <!-- Full URL -->
{{ url.current_path }}          <!-- Path with query string -->
{{ url.host }}                  <!-- Hostname -->
{{ url.query_string }}          <!-- Query string -->

path and url.* echo what the visitor requested. Pipe them through escape when printing them into HTML.

Page Variables

page

Current page object:

{{ page.title }}                <!-- Page title -->
{{ page.url }}                  <!-- Page URL -->
{{ page.slug }}                 <!-- Page slug -->
{{ page.fullpath }}             <!-- Full path -->
{{ page.meta_description }}     <!-- SEO description -->
{{ page.parent }}               <!-- Parent page -->
{{ page.children }}             <!-- Child pages -->
{{ page.updated_at }}           <!-- Last update -->
{{ page.translations }}         <!-- Available translations -->
{{ page.homepage? }}            <!-- Boolean: is the homepage -->

Page content lives in editable regions, not in a page.content field. On pages without a page record (search, 404, consent screen), page only has title and translations.

Canvas and Editables:

{% editable_canvas content %}
  <!-- Editable page content -->
{% endeditable_canvas %}

preview_mode

Set when a page is opened through a preview link (?preview=<token>), and absent for regular visitors:

  • "draft": the page's unpublished draft is shown.
  • "live": the token is valid but the page has no draft, so the current content is shown (even if the page is not published).
{% if preview_mode %}
  <div class="preview-banner">
    Preview ({{ preview_mode }}) - visitors don't see this version yet.
  </div>
{% endif %}

Preview responses are sent with X-Robots-Tag: noindex.

Template Variables

template

Current template identifier:

{{ template }}                  <!-- "page", "shop_product", "customers_login", ... -->
{{ template_name }}             <!-- "page", "product", "login", ... -->

{% if template == 'shop_product' %}
  <!-- Product-specific code -->
{% endif %}

{% if template == '404' %}
  <!-- Themed 404 page -->
{% endif %}

template is the template path without extension, with / replaced by _: shop/product.liquid gives shop_product, 404.liquid gives 404. template_name is only the file name: product.

Locale Variables

locale

Current active locale:

{{ locale }}                    <!-- "en", "nl", "fr", etc. -->
{{ default_locale }}            <!-- The site's default locale -->

{% if locale == 'nl' %}
  <!-- Dutch-specific content -->
{% endif %}

locale_url_prefix

Locale URL prefix:

{{ locale_url_prefix }}         <!-- "/nl", "/fr", "" for default -->

<a href="{{ locale_url_prefix }}/about">About</a>

Product Variables

product

Current product (on product template):

{{ product.id }}                <!-- Product ID -->
{{ product.name }}              <!-- Product name -->
{{ product.description }}       <!-- Description -->
{{ product.price }}             <!-- Price -->
{{ product.on_sale }}           <!-- Boolean: on sale -->
{{ product.on_sale_price }}     <!-- Sale price -->
{{ product.sku }}               <!-- SKU -->
{{ product.status }}            <!-- "active", "sold_out", "coming_soon", "hidden" -->
{{ product.sold_out? }}         <!-- Boolean: sold out -->
{{ product.current_stock }}     <!-- Available stock -->
{{ product.url }}               <!-- Product URL -->
{{ product.images }}            <!-- Array of images -->
{{ product.variants }}          <!-- Array of variants -->
{{ product.created_at }}        <!-- Creation date -->
{{ product.updated_at }}        <!-- Last update -->

Product Images:

{{ product.images.first.url }}  <!-- First image URL -->
{{ product.images.size }}       <!-- Image count -->

{% for image in product.images %}
  <img src="{{ image.url }}" width="{{ image.width }}" height="{{ image.height }}" alt="{{ product.name | escape }}">
{% endfor %}

Product Variants:

{{ product.variants.first.id }}
{{ product.variants.first.label }}
{{ product.variants.first.price }}
{{ product.variants.first.sku }}
{{ product.variants.first.stock }}

products

All products collection:

{{ products.count }}            <!-- Product count -->

{% for product in products.all %}
  {{ product.name }}
{% endfor %}

Cart Variables

cart

Shopping cart:

{{ cart.items }}                <!-- Cart items array -->
{{ cart.items.size }}           <!-- Number of lines -->
{{ cart.item_count }}           <!-- Item count -->
{{ cart.subtotal }}             <!-- Subtotal amount -->
{{ cart.total }}                <!-- Total amount -->
{{ cart.coupon_code }}          <!-- Applied coupon code -->
{{ cart.coupon_total }}         <!-- Coupon discount -->
{{ cart.shipping_total }}       <!-- Shipping cost -->

Cart Items:

{% for item in cart.items %}
  {{ item.product.name }}       <!-- Product name -->
  {{ item.variant.label }}      <!-- Variant name -->
  {{ item.quantity }}           <!-- Quantity -->
  {{ item.unit_price }}         <!-- Unit price -->
  {{ item.price }}              <!-- Line total -->
  {{ item.id }}                 <!-- Line item ID -->
{% endfor %}

Customer Variables

customer

Current logged-in customer:

{{ customer.id }}               <!-- Customer ID -->
{{ customer.email }}            <!-- Email -->
{{ customer.firstname }}        <!-- First name -->
{{ customer.lastname }}         <!-- Last name -->
{{ customer.name }}             <!-- Full name -->
{{ customer.number }}           <!-- Customer number -->
{{ customer.created_at }}       <!-- Registration date -->
{{ customer.orders }}           <!-- Orders array -->
{{ customer.orders.size }}      <!-- Order count -->
{{ customer.identities.microsoft }}  <!-- Linked login provider, or nil -->

{% if customer %}
  <!-- Logged in -->
{% else %}
  <!-- Guest -->
{% endif %}

customer.identities.<provider> is set for each linked login provider (facebook, twitter, nimbu, microsoft, saml). See Customer Login.

Custom customer fields (such as a phone number) are available by their field name.

Customer Address:

{{ customer.default_shipping_address.street }}
{{ customer.default_shipping_address.number }}
{{ customer.default_shipping_address.zipcode }}
{{ customer.default_shipping_address.city }}
{{ customer.default_shipping_address.country }}
{{ customer.default_billing_address.company }}
{{ customer.addresses }}        <!-- All addresses -->

Order Variables

order

Current order (on order template):

{{ order.id }}                  <!-- Order ID -->
{{ order.number }}              <!-- Order number -->
{{ order.created_at }}          <!-- Order date -->
{{ order.status }}              <!-- Order status -->
{{ order.paid? }}               <!-- Boolean: paid -->
{{ order.payment_method }}      <!-- Payment method -->
{{ order.subtotal }}            <!-- Subtotal -->
{{ order.total }}               <!-- Total -->
{{ order.items }}               <!-- Order items -->
{{ order.shipping_address }}    <!-- Shipping address -->
{{ order.billing_address }}     <!-- Billing address -->
{{ order.attachments }}         <!-- Generated downloads -->
{{ order.attachments_expired? }} <!-- Downloads removed after the retention period -->

See Order downloads for the download and regeneration flow.

Blog Variables

blog

Current blog:

{{ blog.name }}                 <!-- Blog name -->
{{ blog.articles }}             <!-- Articles array -->
{{ blog.articles.size }}        <!-- Article count -->
{{ blog.url }}                  <!-- Blog URL -->

article

Current article (on article template):

{{ article.id }}                <!-- Article ID -->
{{ article.title }}             <!-- Title -->
{{ article.content }}           <!-- Content -->
{{ article.excerpt }}           <!-- Excerpt -->
{{ article.author }}            <!-- Author name -->
{{ article.published_at }}      <!-- Published date -->
{{ article.url }}               <!-- Article URL -->
{{ article.tags }}              <!-- Tags array -->
{{ article.blog }}              <!-- Blog -->

Channel Variables

channels

All custom channels:

{{ channels.team }}             <!-- Team channel -->
{{ channels.testimonials }}     <!-- Testimonials channel -->
{{ channels.events }}           <!-- Events channel -->

{% for member in channels.team.all %}
  {{ member.name }}
  {{ member.role }}
{% endfor %}

Channel Methods:

{{ channels.team.all }}         <!-- All entries -->
{{ channels.team.first }}       <!-- First entry -->
{{ channels.team.last }}        <!-- Last entry -->
{{ channels.team.latest }}      <!-- Most recent -->
{{ channels.team.random }}      <!-- Random entries -->
{{ channels.team.count }}       <!-- Entry count -->
{{ channels.team.empty? }}      <!-- Boolean: empty -->
{{ channels.team.any? }}        <!-- Boolean: has entries -->

Site menus:

{{ menus.main }}                <!-- Main menu -->
{{ menus.footer }}              <!-- Footer menu -->

{% for item in menus.main.items %}
  {{ item.name }}               <!-- Menu item name -->
  {{ item.target }}             <!-- Menu item URL -->
  {{ item.active? }}            <!-- Boolean: active -->
  {{ item.children }}           <!-- Submenu items -->
{% endfor %}

URL Variables

url

URL helpers:

{{ url.current }}               <!-- Full current URL -->
{{ url.current_path }}          <!-- Current path with query string -->
{{ url.root }}                  <!-- Home URL -->
{{ url.shop }}                  <!-- Shop URL -->
{{ url.cart }}                  <!-- Cart URL -->
{{ url.checkout }}              <!-- Checkout URL -->
{{ url.login }}                 <!-- Login URL -->
{{ url.logout }}                <!-- Logout URL -->
{{ url.account }}               <!-- Account URL -->
{{ url.register }}              <!-- Registration URL -->
{{ url.search }}                <!-- Search URL -->

Config Variables

config

Site configuration:

{{ config.locales }}            <!-- Visible locales as [name, code] pairs -->
{{ config.all_locales }}        <!-- All locales, including hidden ones -->
{{ config.hidden_locales }}     <!-- Hidden locales -->
{{ config.countries }}          <!-- Countries for address forms -->
{{ config.form_challenge }}     <!-- Active spam protection provider -->
{% for pair in config.locales %}
  <a href="/{{ pair[1] }}">{{ pair[0] }}</a>
{% endfor %}

Now / Today

now

Current timestamp:

{{ now | date: "%Y-%m-%d" }}    <!-- Today's date -->
{{ now | date: "%H:%M:%S" }}    <!-- Current time (UTC) -->
{{ today }}                     <!-- Today's date -->

Pagination Variables

paginate

Pagination object (within {% paginate %}):

{{ paginate.collection }}       <!-- ⚠️ IMPORTANT: Paginated subset of items to iterate -->
{{ paginate.current_page }}     <!-- Current page number -->
{{ paginate.total_pages }}      <!-- Total number of pages -->
{{ paginate.total_entries }}    <!-- Total number of items across all pages -->
{{ paginate.per_page }}         <!-- Items per page -->
{{ paginate.previous_page }}    <!-- Previous page number (or nil if first page) -->
{{ paginate.next_page }}        <!-- Next page number (or nil if last page) -->
{{ paginate.next.url }}         <!-- Next page URL -->
{{ paginate.previous.url }}     <!-- Previous page URL -->
{{ paginate.parts }}            <!-- Page links array -->
<!-- ✅ CORRECT: Iterate paginate.collection -->
{% paginate products.all by 24 %}
  {% for product in paginate.collection %}
    {{ product.name }}
  {% endfor %}
{% endpaginate %}

<!-- ❌ WRONG: This shows ALL items on every page! -->
{% paginate products.all by 24 %}
  {% for product in products.all %}
    {{ product.name }}
  {% endfor %}
{% endpaginate %}

The paginate.collection property contains only the items for the current page (e.g., items 1-24 on page 1, items 25-48 on page 2, etc.). If you iterate the original collection instead, all items will appear on every page, defeating the purpose of pagination.

{% paginate products.all by 24 %}
  {% assign offset_start = paginate.current_page | minus: 1 | times: paginate.per_page | plus: 1 %}
  {% assign offset_end = paginate.current_page | times: paginate.per_page | at_most: paginate.total_entries %}

  <p>Showing {{ offset_start }}-{{ offset_end }} of {{ paginate.total_entries }} products</p>
{% endpaginate %}

Search Variables

results

On the search page (templates/search.liquid), results is a hash with products, pages, articles, db (channel entries) and all, plus any?, products?, pages?, articles? and db?. Inside a {% search %} block, results is the list of matching drops.

{% if results.any? %}
  {% for result in results.all %}
    <a href="{{ result.url }}">{{ result.title }}</a>
  {% endfor %}
{% endif %}

See Search for the full reference.

Quick Reference Tables

Common Objects

ObjectDescriptionExample
siteSite information{{ site.name }}
pageCurrent page{{ page.title }}
productCurrent product{{ product.name }}
cartShopping cart{{ cart.total }}
customerLogged-in customer{{ customer.email }}
localeCurrent locale{{ locale }}
paramsURL parameters{{ params.page }}

Common Arrays

ArrayDescriptionIteration
products.allAll products{% for p in products.all %}
cart.itemsCart items{% for item in cart.items %}
page.translationsTranslations{% for t in page.translations %}
menus.main.itemsMenu items{% for item in menus.main.items %}
blog.articlesArticles{% for article in blog.articles %}

Boolean Checks

VariableCheckUsage
customerLogged in{% if customer %}
product.sold_out?Sold out{% if product.sold_out? %}
cart.items.sizeHas items{% if cart.items.size > 0 %}
params.qHas query{% if params.q %}

Next Steps

Master all global variables in Nimbu themes!

On this page