Skip to content

Instantly share code, notes, and snippets.

@junaidkbr
Created September 21, 2020 18:28
Show Gist options
  • Save junaidkbr/a5e8898f7b7397570a1ae27019f7ba5b to your computer and use it in GitHub Desktop.
Save junaidkbr/a5e8898f7b7397570a1ae27019f7ba5b to your computer and use it in GitHub Desktop.
{% comment %}
Get page handle based on page type
{% endcomment %}
{% liquid
assign page_handle = ''
assign page_type = request.page_type
case page_type
when 'index'
assign page_handle = 'index'
when 'page'
assign page_handle = page.handle
when 'product'
assign page_handle = product.handle
when 'list-collections'
assign page_handle = 'all-collections'
when 'collection'
assign page_handle = collection.handle
when 'article'
assign page_handle = article.handle
endcase
%}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment