Context by Page
Which template objects are available on each page type across the storefront.
The data in your templates changes based on which page is being viewed. Every page gets the global objects. Some pages add extra objects for their specific content.
Global objects (all pages)
These objects are available on every page:
| Object | Type | Description |
|---|---|---|
store | object | Store name, currency, logo, contact details, address |
request | object | Current path, host domain, visitor country, locale |
page_title | string | Title of the current page |
canonical_url | string | Canonical URL for SEO |
collections | array | All store collections (id, title, handle, url) |
theme | object | Theme-level settings |
Page-specific objects
Some pages add extra objects. These are only available on that page type:
| Page Type | Extra Object | Type | Description |
|---|---|---|---|
| Product page | product | object | Full product data (title, price, images, variants, tags) |
| Collection page | collection | object | Collection data (title, description, products, sorting) |
| Info page | page | object | Page data (title, content, handle) |
| Cart page | cart | object | Cart items, quantities, totals |
| Blog post | article | object | Post title, content, author, date, tags |
| Customer account | customer | object | Name, email, addresses, order history |
Quick reference matrix
| Object | Homepage | Product | Collection | Info Page | Cart | Blog | Account |
|---|---|---|---|---|---|---|---|
store | Yes | Yes | Yes | Yes | Yes | Yes | Yes |
request | Yes | Yes | Yes | Yes | Yes | Yes | Yes |
page_title | Yes | Yes | Yes | Yes | Yes | Yes | Yes |
canonical_url | Yes | Yes | Yes | Yes | Yes | Yes | Yes |
collections | Yes | Yes | Yes | Yes | Yes | Yes | Yes |
theme | Yes | Yes | Yes | Yes | Yes | Yes | Yes |
product | No | Yes | No | No | No | No | No |
collection | No | No | Yes | No | No | No | No |
page | No | No | No | Yes | No | No | No |
cart | No | No | No | No | Yes | No | No |
article | No | No | No | No | No | Yes | No |
customer | No | No | No | No | No | No | Yes |
Custom HTML sections
Custom HTML sections on the homepage get the global objects only. The product, collection, cart, and customer objects are not available. The homepage has no single product or collection in scope.
To show product data, use the collections array. Loop through it and link to each collection:
{% for c in collections %}
<a href="{{ c.url }}">{{ c.title }}</a>
{% endfor %}For product-level templates, use the full theme template system. The product object is available on product pages.
Store object details
The store object is available everywhere and contains:
{{ store.name }} <!-- Store display name -->
{{ store.description }} <!-- Store description -->
{{ store.currency }} <!-- ISO code, e.g. GBP -->
{{ store.currency_symbol }} <!-- Symbol, e.g. £ -->
{{ store.url }} <!-- Full store URL -->
{{ store.email }} <!-- Contact email -->
{{ store.phone }} <!-- Phone number -->
{{ store.logo }} <!-- Logo image URL -->
{{ store.address.address1 }} <!-- Street address -->
{{ store.address.city }} <!-- City -->
{{ store.address.province }} <!-- Province or state -->
{{ store.address.zip }} <!-- Postal code -->
{{ store.address.country }} <!-- Country -->Request object details
The request object tells you about the current visitor:
{{ request.path }} <!-- Current page path, e.g. / or /products/ring -->
{{ request.host }} <!-- Host domain, e.g. mystore.com -->
{{ request.country }} <!-- Visitor country code, e.g. GB, US, DE -->
{{ request.locale }} <!-- Locale, e.g. en -->Use request.country for geo-targeted content:
{% if request.country == 'US' %}
<p>Shipping from our US warehouse.</p>
{% endif %}Checking for nil
Page-specific objects are nil on the wrong page type. Guard your templates with an if check:
{% if product %}
<h1>{{ product.title }}</h1>
{% endif %}This prevents errors when the object does not exist. On the homepage, product is nil. The block is skipped.