get current url in liquid file

dhruveonmars
Tourist
7 0 0

@Akhilkotha96 could you clarify?

 

If you mean, you only want some code to be rendered on the homepage, you could use 

{% if template.name == "index" %}
    do something
{% endif %}

or if you want to check which template is being used, something along the lines of this would work

{% if template contains 'page.templatename' %}
    do something
{% endif %}

 

0 Likes
Annv-hkusa
New Member
2 0 0

This worked for me, thanks a lot @Leysam !

shopify request object

I used in one of the snippet for highlighting the navigations

{% if request.path contains '/path/' %} // do some modification!{% endif %}
 
Its was quick and easy. Pulled up the right blog excerpt- article.
0 Likes