How to Add Current Filter/Tag to My H1

Solved
Tourist
14 0 0

Hi everyone,

 

I have my tags in filter section. As you can see in this URL https://www.jewelsformen.com/collections/gold-rings/emerald Gold Rings is collection. Emerald is tag. So this tag selected and I want to add this tag to here: http://prntscr.com/pgyu4w

 

I found the liquid file but I couldn't add liquid object in there. How can I do this?


Thanks

0 Likes

Success.

Astronaut
1082 147 272

You can use the current_tags object:

 

https://help.shopify.com/en/themes/liquid/objects/current-tags

 

So find your collection title and use an if statement to check if there's current_tags, if there is, show it:

 

<h1 class="heading">{{ collection.title }}{% if current_tags %}<span class="current_tags">{{ current_tags.first }}</span>{% endif %}</h1>

 

 

If you'd like to make any edits to your store, please send me a personal message and we can discuss what you'd like to accomplish :D
0 Likes
Tourist
14 0 0

I looked at this documents hours but didn't find this .first section.


With your help finally solved. Now I should make these uppercase.

 

Thanks a lot Ninthony.

0 Likes
Astronaut
1082 147 272

No problem, glad it helped. 

If you'd like to make any edits to your store, please send me a personal message and we can discuss what you'd like to accomplish :D
0 Likes