What is a Shopify handle and how to work with it?

Tweet LinkedIn
HANDLE

Shopify handles are a core concept in Shopify development, crucial for developers and for admins that manage e-commerce stores built on the Shopify platform.

In this article I’ll explain what Shopify handles are and provide guidance on how to work effectively with them.

What is a Shopify handle?

A Shopify handle is a unique identifier used by Shopify to create SEO-friendly URLs for various resources within a Shopify store, such as products, collections, pages, navigation menus, blog posts / articles and many more.

Handles are automatically generated by Shopify based on the name of the resource but can be customized by the store owner or developer.

A handle is typically the resource name in lowercase, with spaces replaced by hyphens.

For example, a product named “Bracelet engraved with diamonds” would have an automatically generated handle like “bracelet-engraved-with-diamonds”, resulting in a URL structured as “https://storename.myshopify.com/products/bracelet-engraved-with-diamonds”.

Customizing handles

Although handles are generated automatically, Shopify allows you to customize them.

This is particularly useful for SEO purposes, allowing you to create more descriptive or shorter URLs.

You can edit a handle directly from the Shopify admin dashboard under the “Search engine listing preview” section of each resource page.

Accessing handles in Shopify admin

Shopify handles can be accessed and modified inside the Shopify admin.

Product handle

To modify the handle of a product go to the product listing page by clicking on the “Products” (marked with 1 in the image below) menu item and select a product (marked with 2 in the image below):

Shopify product listing page.
Shopify product listing page.

Scroll down until you see the “Search engine listing” section (marked with 1 in the image below).

Click on the “Edit” link (marked with 2 in the image below).

You can also see the existing handle (marked with 3 in the image below).

Shopify product search engine listing preview.
Shopify product search engine listing preview.

The editing fields will open and you can modify the handle in the “URL handle”.

In the link “https//storename.myshopify.com/products/your-new-url” the last part is the product handle, in our example is “your-new-url” (marked with 1 in the image below).

This is also the only part Shopify allows you to edit in the product URL structure.

For more control over the product URL structure you need a Shopify Headless store.

After you modify the handle Shopify creates a URL redirect (marked with 2 in the image below)  automatically which will be added to the store “robots.txt” file.

You have the option to not create the redirect by unchecking the checkbox (marked with 3 in the image below).

The redirect is needed only if the store is live. If the store is in development mode you do not need the redirect and you can safely uncheck the checkbox.

The redirect is needed in place according to Google for at least 1 year since the new handle is in place.

As you edit the URL handle (marked with 1 in the image below) you can also see how this will reflect on the search engines (marked with 4 in the image below).

After you finish editing the handle, save your changes  by clicking the “Save” button (marked with 5 in the image below).

Edit the product handle inside the search engine listing preview.
Edit the product handle inside the search engine listing preview.

Collection handle

To modify the handle of a collection go to the collection listing page by listing on the “Collections” (marked with 1 in the image below) menu item and select a collection (marked with 2 in the image below):

Shopify collection listing page.
Shopify collection listing page.

Scroll down until you see the “Search engine listing” section (marked with 1 in the image below).

Click on the “Edit” link (marked with 2 in the image below).

You can also see the existing handle (marked with 3 in the image below).

Shopify collection search engine listing preview.
Shopify collection search engine listing preview.

The editing fields will open and you can modify the handle in the “URL handle”.

In the link “https//storename.myshopify.com/products/your-new-handle” the last part is the collection handle, in our example is “your-new-handle” (marked with 1 in the image below).

This is also the only part Shopify allows you to edit in the collection URL structure.

For more control over the collection URL structure you need a Shopify Headless store.

After you modify the handle Shopify creates a URL redirect (marked with 2 in the image below)  automatically which will be added to the store “robots.txt” file.

You have the option to not create the redirect by unchecking the checkbox (marked with 3 in the image below).

The redirect is needed only if the store is live. If the store is in development mode you do not need the redirect and you can safely uncheck the checkbox.

The redirect is needed in place according to Google for at least 1 year since the new handle is in place.

As you edit the URL handle (marked with 1 in the image below) you can also see how this will reflect on the search engines (marked with 4 in the image below).

After you finish editing the handle, save your changes  by clicking the “Save” button (marked with 5 in the image below).

Edit the collection handle inside the search engine listing preview.
Edit the collection handle inside the search engine listing preview.

Page handle

To modify the handle of a page go to the “Online Store” (marked with 1 in the image below) sales channel next go to the pages listing page by clicking on the “Pages” (marked with 2 in the image below) menu item and select a collection (marked with 3 in the image below):

Shopify pages listing page.
Shopify pages listing page.

Scroll down until you see the “Search engine listing preview” section (marked with 1 in the image below).

Click on the “Edit website SEO” link (marked with 2 in the image below).

You can also see the existing handle (marked with 3 in the image below).

Shopify page search engine listing preview.
Shopify page search engine listing preview.

The editing fields will open and you can modify the handle in the “URL handle”.

In the link “https//storename.myshopify.com/products/your-new-handle” the last part is the page handle, in our example is “your-new-handle” (marked with 1 in the image below).

This is also the only part Shopify allows you to edit in the page URL structure.

For more control over the page URL structure you need a Shopify Headless store.

After you modify the handle Shopify creates a URL redirect (marked with 2 in the image below)  automatically which will be added to the store “robots.txt” file.

You have the option to not create the redirect by unchecking the checkbox (marked with 3 in the image below).

The redirect is needed only if the store is live. If the store is in development mode you do not need the redirect and you can safely uncheck the checkbox.

The redirect is needed in place according to Google for at least 1 year since the new handle is in place.

As you edit the URL handle (marked with 1 in the image below) you can also see how this will reflect on the search engines (marked with 4 in the image below).

After you finish editing the handle, save your changes  by clicking the “Save” button (marked with 5 in the image below).

Edit the page handle inside the search engine listing preview.
Edit the page handle inside the search engine listing preview.

Blog handle

To modify the handle of a blog go to the “Online Store” (marked with 1 in the image below) sale channel next go to the blog posts listing page on the “Blog posts” (marked with 2 in the image below) menu item and select “Manage Blogs” (marked with 3 in the image below) to display the blogs listing page:

Shopify blog posts listing page.
Shopify blog posts listing page.

On the blogs listing page select the blog to which you want the change the handle:

Select the Shopify blog.
Select the Shopify blog.

On the “Search engine listing preview” (marked with 1 in the image below) click on the “Edit website SEO” link (marked with 2 in the image below):

Shopify blog search engine listing preview.
Shopify blog search engine listing preview.

The editing fields will open and you can modify the handle in the “URL handle”.

In the link “https//storename.myshopify.com/blogs/your-new-blog-title” the last part is the blog handle, in our example is your-new-blog-title” (marked with 1 in the image below).

This is also the only part Shopify allows you to edit in the blog URL structure.

For more control over the blog URL structure you need a Shopify Headless store.

After you modify the handle Shopify creates a URL redirect (marked with 2 in the image below)  automatically which will be added to the store “robots.txt” file.

You have the option to not create the redirect by unchecking the checkbox (marked with 3 in the image below).

The redirect is needed only if the store is live. If the store is in development mode you do not need the redirect and you can safely uncheck the checkbox.

The redirect is needed in place according to Google for at least 1 year since the new handle is in place.

As you edit the URL handle (marked with 1 in the image below) you can also see how this will reflect on the search engines (marked with 4 in the image below).

After you finish editing the handle, save your changes  by clicking the “Save” button (marked with 5 in the image below).

Edit the blog handle inside the search engine listing preview.
Edit the blog handle inside the search engine listing preview.

Blog post handle / Article handle

Blog post handle or article handle are the same.

Shopify refers to blog posts as articles in their documentation so it’s a bit confusing if you come from WordPress and have a background in blogging.

To modify the handle of a blog go to the “Online Store” (marked with 1 in the image below) sale channel next go to the blog posts listing page on the “Blog posts” (marked with 2 in the image below) menu item and select a blog post (marked with 3 in the image below) to display the blog post editing page:

Shopify blog posts listing preview.
Shopify blog posts listing preview.

On the “Search engine listing preview” (marked with 1 in the image below) click on the “Edit website SEO” link (marked with 2 in the image below).

You can see the existing URL handle (marked with 3 in the image below).

Blog post search engine listing preview.
Blog post search engine listing preview.

The editing fields will open and you can modify the handle in the “URL handle”.

In the link “https//storename.myshopify.com/blogs/new-post-handle” the last part is the blog post / article handle, in our example is “new-post-handle” (marked with 1 in the image below).

This is also the only part Shopify allows you to edit in the blog post URL structure.

For more control over the blog URL structure you need a Shopify Headless store.

After you modify the handle Shopify creates a URL redirect (marked with 2 in the image below)  automatically which will be added to the store “robots.txt” file.

You have the option to not create the redirect by unchecking the checkbox (marked with 3 in the image below).

The redirect is needed only if the store is live. If the store is in development mode you do not need the redirect and you can safely uncheck the checkbox.

The redirect is needed in place according to Google for at least 1 year since the new handle is in place.

As you edit the URL handle (marked with 1 in the image below) you can also see how this will reflect on the search engines (marked with 4 in the image below).

After you finish editing the handle, save your changes  by clicking the “Save” button (marked with 5 in the image below).

Edit the blog post handle inside the search engine listing preview.
Edit the blog post handle inside the search engine listing preview.

Navigation menus handle

To modify the handle of a menu go to the “Online Store” (marked with 1 in the image below) sale channel, next go to the menus listing page on the “Navigation” (marked with 2 in the image below) menu item and select a menu (marked with 3 in the image below) to display the blog post editing page.

Note that handles that are used to display menus inside the theme are not editable in admin since their handle is in use inside the theme and that modifying the handle will break the theme and make the menu unusable.

Shopify listing menus page.
Shopify listing menus page.

Now you’ll see the menu editing page. Here you can edit the entire menu but we are interested in the “Handle” section (marked with 1 in the image below).

In my example the menu handle is “demo-menu” (marked with 2 in the image below). The handle is generated based on the menu title at first.

Change the menu handle to whatever you want and save your changes by clicking the “Save menu” button (marked with 3 in the image below).

Edit the menu handle inside the “Handle” section.
Edit the menu handle inside the “Handle” section.

Accessing handles in Shopify Liquid

Handles are accessible through Shopify’s Admin API or Storefront API, which you can use to retrieve, create, update, or delete resources within your Shopify store.

They are also available in the Shopify Liquid template language, allowing dynamic content generation based on the handle of the current page or resource.

Shopify Liquid uses handles to load specific resources.

For instance, if you want to link to a specific product or collection in your store’s theme, you can use the handle within Liquid tags.

To use any of the handles listed below you need to add the code in a page that supports that resource or in a section that is assigned to the resource page.

For example, for the product handle to be outputted to the screen you need to use the {{ product.handle }} liquid code on the product resource page or on a section or block that is listed on the product page.

If you use the liquid code {{ product.handle }} on a collection page nothing will be displayed since the collection page has a {{ collection.handle }} and not a {{ product.handle }}.

So be careful when you use that to avoid confusion.

Product

{{ product.handle }}

Collection

{{ collection.handle }}

Page

{{ page.handle }}

Blog

{{ blog.handle }}

Blog Posts

{{ article.handle }}

Link

{{ link.handle }}

Navigation Menus

Navigation menus in Shopify can be dynamically generated using Shopify handles.

This allows you to create links in your navigation that point to specific collections, products, pages, or blog posts based on their handles.

Suppose you have a navigation menu that includes links to various collections or custom pages.

You can use the following Liquid snippet to iterate over a menu called “main-menu” and generate links dynamically.

This example assumes you have a link list (navigation menu) set up in your Shopify admin with the handle “main-menu”:

<ul>
  {% for link in linklists.main-menu.links %}
    <li>
      <a href="{{ link.url }}">{{ link.title }}</a>
    </li>
  {% endfor %}
</ul>

Markets

{{ market.handle }}

Metaobjects

{{ metaobject_system.handle }}

Shipping methods

{{ shipping_method.handle }}

Convert a string into a handle

If you have a string in Liquid and you want to convert it to a handle to use it inside code you do the following:

You have the product title which will be: “My product”.

Liquid:

{{ product.title | handleize }}
{{ product.title | handle }}

Output:

my-product

Conclusion

Shopify handles play a pivotal role in the management and navigation of Shopify stores, impacting both user experience and SEO.

Understanding how to access, use, and customize these handles is essential for developers looking to build or manage Shopify stores effectively.

By following the practices outlined above, you can ensure that your store takes full advantage of what Shopify handles have to offer, creating a more navigable, SEO-friendly, and efficient online store.