Global Variables
Nimbu provides a comprehensive set of global variables (drops) accessible in all Liquid templates.
Site Variables
site
Global site information:
liquid
{{ site.name }} <!-- Site name -->
{{ site.url }} <!-- Site URL -->
{{ site.currency }} <!-- Currency code (EUR, USD, etc.) -->
{{ site.locale }} <!-- Default locale -->
{{ site.email }} <!-- Site contact email -->
{{ site.phone }} <!-- Site phone number -->
{{ site.address }} <!-- Site address object -->
{{ site.meta_description }} <!-- Site description -->
{{ site.meta_keywords }} <!-- Site keywords -->Request Variables
params
URL query parameters:
liquid
{{ params.page }} <!-- ?page=2 -->
{{ params.category }} <!-- ?category=shoes -->
{{ params.q }} <!-- ?q=search+term -->
{% if params.filter %}
<!-- Check parameter exists -->
{% endif %}request
Current request information:
liquid
{{ request.url }} <!-- Full URL -->
{{ request.path }} <!-- Path only -->
{{ request.host }} <!-- Hostname -->
{{ request.protocol }} <!-- http or https -->Page Variables
page
Current page object:
liquid
{{ page.title }} <!-- Page title -->
{{ page.content }} <!-- Page content -->
{{ page.url }} <!-- Page URL -->
{{ page.slug }} <!-- Page slug -->
{{ page.created_at }} <!-- Creation date -->
{{ page.updated_at }} <!-- Last update -->
{{ page.translations }} <!-- Available translations -->
{{ page.locale }} <!-- Page locale -->
{{ page.template }} <!-- Template name -->Canvas and Editables:
liquid
{% editable_canvas content %}
<!-- Editable page content -->
{% endeditable_canvas %}Template Variables
template
Current template identifier:
liquid
{{ template }} <!-- "product", "article", "page", etc. -->
{% if template == 'product' %}
<!-- Product-specific code -->
{% endif %}Locale Variables
locale
Current active locale:
liquid
{{ locale }} <!-- "en", "nl", "fr", etc. -->
{% if locale == 'nl' %}
<!-- Dutch-specific content -->
{% endif %}locale_url_prefix
Locale URL prefix:
liquid
{{ locale_url_prefix }} <!-- "/nl", "/fr", "" for default -->
<a href="{{ locale_url_prefix }}/about">About</a>Product Variables
product
Current product (on product template):
liquid
{{ product.id }} <!-- Product ID -->
{{ product.name }} <!-- Product name -->
{{ product.description }} <!-- Description -->
{{ product.price }} <!-- Price -->
{{ product.compare_at_price }} <!-- Original price -->
{{ product.sku }} <!-- SKU -->
{{ product.available }} <!-- Boolean: in stock -->
{{ product.on_sale }} <!-- Boolean: on sale -->
{{ product.url }} <!-- Product URL -->
{{ product.images }} <!-- Array of images -->
{{ product.variants }} <!-- Array of variants -->
{{ product.tags }} <!-- Array of tags -->
{{ product.created_at }} <!-- Creation date -->
{{ product.updated_at }} <!-- Last update -->Product Images:
liquid
{{ product.images.first.url }} <!-- First image URL -->
{{ product.images.size }} <!-- Image count -->
{% for image in product.images %}
{{ image.url }}
{{ image.alt }}
{% endfor %}Product Variants:
liquid
{{ product.variants.first.id }}
{{ product.variants.first.title }}
{{ product.variants.first.price }}
{{ product.variants.first.sku }}
{{ product.variants.first.available }}products
All products collection:
liquid
{{ products }} <!-- All products -->
{{ products.size }} <!-- Product count -->
{% for product in products %}
{{ product.name }}
{% endfor %}Cart Variables
cart
Shopping cart:
liquid
{{ cart.items }} <!-- Cart items array -->
{{ cart.items.size }} <!-- Item count -->
{{ cart.item_count }} <!-- Total quantity -->
{{ cart.subtotal }} <!-- Subtotal amount -->
{{ cart.total }} <!-- Total amount -->
{{ cart.total_discount }} <!-- Discount amount -->
{{ cart.shipping_cost }} <!-- Shipping cost -->
{{ cart.currency }} <!-- Currency code -->
{{ cart.coupon }} <!-- Applied coupon -->Cart Items:
liquid
{% for item in cart.items %}
{{ item.product.name }} <!-- Product name -->
{{ item.variant.title }} <!-- Variant title -->
{{ item.quantity }} <!-- Quantity -->
{{ item.price }} <!-- Unit price -->
{{ item.line_price }} <!-- Total price -->
{{ item.id }} <!-- Line item ID -->
{% endfor %}Customer Variables
customer
Current logged-in customer:
liquid
{{ customer.id }} <!-- Customer ID -->
{{ customer.email }} <!-- Email -->
{{ customer.first_name }} <!-- First name -->
{{ customer.last_name }} <!-- Last name -->
{{ customer.full_name }} <!-- Full name -->
{{ customer.phone }} <!-- Phone -->
{{ customer.created_at }} <!-- Registration date -->
{{ customer.orders }} <!-- Orders array -->
{{ customer.orders.size }} <!-- Order count -->
{% if customer %}
<!-- Logged in -->
{% else %}
<!-- Guest -->
{% endif %}Customer Address:
liquid
{{ customer.default_address.address1 }}
{{ customer.default_address.city }}
{{ customer.default_address.country }}
{{ customer.default_address.zip }}Order Variables
order
Current order (on order template):
liquid
{{ order.id }} <!-- Order ID -->
{{ order.number }} <!-- Order number -->
{{ order.created_at }} <!-- Order date -->
{{ order.status }} <!-- Order status -->
{{ order.payment_status }} <!-- Payment status -->
{{ order.subtotal }} <!-- Subtotal -->
{{ order.total }} <!-- Total -->
{{ order.items }} <!-- Order items -->
{{ order.shipping_address }} <!-- Shipping address -->
{{ order.billing_address }} <!-- Billing address -->Blog Variables
blog
Current blog:
liquid
{{ blog.name }} <!-- Blog name -->
{{ blog.articles }} <!-- Articles array -->
{{ blog.articles.size }} <!-- Article count -->
{{ blog.url }} <!-- Blog URL -->article
Current article (on article template):
liquid
{{ article.id }} <!-- Article ID -->
{{ article.title }} <!-- Title -->
{{ article.content }} <!-- Content -->
{{ article.excerpt }} <!-- Excerpt -->
{{ article.author }} <!-- Author object -->
{{ article.published_at }} <!-- Published date -->
{{ article.image }} <!-- Featured image -->
{{ article.url }} <!-- Article URL -->
{{ article.tags }} <!-- Tags array -->
{{ article.comments }} <!-- Comments array -->Channel Variables
channels
All custom channels:
liquid
{{ 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:
liquid
{{ 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 -->Menu Variables
menus
Site menus:
liquid
{{ 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:
liquid
{{ url.current_path }} <!-- Current path -->
{{ url.home }} <!-- 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 -->Config Variables
config
Site configuration:
liquid
{{ config.locales }} <!-- Available locales -->
{{ config.default_locale }} <!-- Default locale -->
{{ config.currencies }} <!-- Available currencies -->
{{ config.features }} <!-- Enabled features -->Now / Today
now
Current timestamp:
liquid
{{ "now" | date: "%Y-%m-%d" }} <!-- Today's date -->
{{ "now" | date: "%H:%M:%S" }} <!-- Current time -->Pagination Variables
paginate
Pagination object (within {% paginate %}):
liquid
{{ paginate.current_page }} <!-- Current page number -->
{{ paginate.pages }} <!-- Total pages -->
{{ paginate.items }} <!-- Total items -->
{{ paginate.page_size }} <!-- Items per page -->
{{ paginate.current_offset }} <!-- Current offset -->
{{ paginate.next.url }} <!-- Next page URL -->
{{ paginate.previous.url }} <!-- Previous page URL -->
{{ paginate.parts }} <!-- Page links array -->Search Variables
search
Search results (within {% search %}):
liquid
{{ search.query }} <!-- Search query -->
{{ search.results }} <!-- Results array -->
{{ search.results.size }} <!-- Result count -->
{% for result in search.results %}
{{ result.title }} <!-- Result title -->
{{ result.url }} <!-- Result URL -->
{{ result.excerpt }} <!-- Text excerpt -->
{{ result.type }} <!-- Content type -->
{{ result.score }} <!-- Relevance score -->
{% endfor %}Quick Reference Tables
Common Objects
| Object | Description | Example |
|---|---|---|
site | Site information | {{ site.name }} |
page | Current page | {{ page.title }} |
product | Current product | {{ product.name }} |
cart | Shopping cart | {{ cart.total }} |
customer | Logged-in customer | {{ customer.email }} |
locale | Current locale | {{ locale }} |
params | URL parameters | {{ params.page }} |
Common Arrays
| Array | Description | Iteration |
|---|---|---|
products | All products | {% for p in products %} |
cart.items | Cart items | {% for item in cart.items %} |
page.translations | Translations | {% for t in page.translations %} |
menus.main.items | Menu items | {% for item in menus.main.items %} |
blog.articles | Articles | {% for article in blog.articles %} |
Boolean Checks
| Variable | Check | Usage |
|---|---|---|
customer | Logged in | {% if customer %} |
product.available | In stock | {% if product.available %} |
cart.items.size | Has items | {% if cart.items.size > 0 %} |
params.q | Has query | {% if params.q %} |
Next Steps
- Filters - Transform variable output
- Channels - Custom content variables
- Webshop - E-commerce variables
- Forms - Form variables
Master all global variables in Nimbu themes!