Liquid Handles
The handle lets you access the attributes of a Liquid object. By default, it is the object's title in lowercase with spaces and special characters replaced by hyphens (-). Every object in Liquid (product, collection, blog, menu) has a handle.
What is a handle?
The handle lets you access Liquid object's properties. It's usually the object's title in lowercase, with spaces and special characters changed to hyphens (-). Every Liquid object (like product, collection, blog, menu) has a handle.
<h2> About Us </h2>
{{ pages.about-us.content }}
</section>
How are my handles created?
A product called 'shirt' will get the handle 'shirt' automatically. If 'shirt' is already taken, the handle will increase by one. So, the next 'shirt' products will be named 'shirt-1', 'shirt-2', etc.
Object handles
Objects like products, collections, articles, and blogs in a store have unique handles. These handles help create the resource's URL or return its properties.
Other objects such as linklists, links, and settings also have handles.
Creating and modifying handles
Handles are created automatically from the resource title. They follow these rules:
- Handles are always in lowercase.
- Spaces and special characters become hyphens (-).
- Multiple spaces or special characters in a row turn into a single hyphen.
- Spaces or special characters at the start are removed.
Handles must be unique. If a title is repeated, the handle will automatically increase by one. For instance, if there are two products named Potion, their handles will be potion and potion-1.
After creating a resource, changing its title won't update the handle.
You can change a resource's handle in the Shopify admin. Do this in the Handle or Edit website SEO sections, depending on the resource. If you use handles to reference resources, remember to update those references when you change handles.
Note: Each link in linklists has a handle derived from its title. You can't change these handles directly. Settings, sections, and blocks in settings_schema.json get their handle from their id property.
Referencing handles
All objects with a handle have a handle property. For example, you can display a product's handle using product.handle. You can refer to an object by its handle from within its parent object in two ways:
- Square bracket notation [ ] : Accepts a handle wrapped in single quotes ' , a Liquid variable, or an object reference.
- Dot notation . : Accepts a handle without quotes.
Enable product suggestions: {{ settings.predictive_search_enabled }}