handle

The handle object returns the handle of the following resources:

  • blogs
  • articles
  • collections
  • pages
  • products.

You can view and edit a resource's handle from the Haravan admin in the Search engine description section: </p>

You can use the handle object to target specific webpages. For example, you could add the following code to the theme.liquid template:

Input
{% if handle contains 'haravan' %}
  <p>Haravan handle.</p>
{% endif %}
Output
Haravan handle.

Webpages that don't have their own handle

Not all webpages have their own handle.

Your store's home page, which uses the template index.liquid, will not return any value for handle:

Input
{% if handle %}
  <p>You are either looking at a product, a collection, a page, a blog, or an article in a blog.<p>
{% else %}
  <p>You must be somewhere else. Hope you're having fun!</p>
{% endif %}
Output
You must be somewhere else. Hope you're having fun!

results matching ""

    No results matching ""