How to remove the underscore in product tag titles?

Solved

How to remove the underscore in product tag titles?

Michau00
Excursionist
19 0 4

Hi I've recently changed my collection header so the H1 includes Collection title and tag. For example Bracelets Colour Blue.

 

That's the code I am using.

 

<h1 class="section-header__title">
{{ collection.title}}{% if current_tags %}: {{ current_tags}} {% endif %}
</h1>

 

However, now I am getting BRACELETS: COLOUR_BLUE. How can I remove the _ between colour and blue?

 

 

Accepted Solution (1)

PageFly-Kate
Shopify Partner
1372 375 425

This is an accepted solution.

Hi @Michau00 ,

This is Kate from PageFly - Landing page builder, I’d like to suggest this idea:

You can remove the underscore between "colour" and "blue" by using the replace filter in Liquid

 

<h1 class="section-header__title">
  {{ collection.title }}{% if current_tags %}: {{ current_tags | join: ' ' | replace: '_', ' ' }} {% endif %}
</h1>

 

Hope my answer will help you.

Kate from PageFly Team

Please let me know if it works by giving it a Like or marking it as a solution!


Unlock the secrets to a record-breaking BFCM with PageFly and Canva


➜ Optimize your Shopify store with PageFly Page Builder (Free plan available)


➜ Weekly updated Shopify tutorials on YouTube


All features are available from the Free plan. Live Chat Support is available 24/7.


View solution in original post

Replies 5 (5)

MarinaPetrovic
Shopify Partner
559 124 193

Hi @Michau00 , you can change it to:

<h1 class="section-header__title">
{{ collection.title}}{% if current_tags %}: {{ current_tags | replace: "_", " "}} {% endif %}
</h1>
M.Petrovic | Shopify Developer
- Was my reply helpful? Click Like to let me know!
- Was your question answered? Mark it as an Accepted Solution
Michau00
Excursionist
19 0 4

Hi! 

 

Thanks but it's giving me BRACELETS: ["COLOUR BLUE"] now. How can I get rid of those ["?

PageFly-Kate
Shopify Partner
1372 375 425

This is an accepted solution.

Hi @Michau00 ,

This is Kate from PageFly - Landing page builder, I’d like to suggest this idea:

You can remove the underscore between "colour" and "blue" by using the replace filter in Liquid

 

<h1 class="section-header__title">
  {{ collection.title }}{% if current_tags %}: {{ current_tags | join: ' ' | replace: '_', ' ' }} {% endif %}
</h1>

 

Hope my answer will help you.

Kate from PageFly Team

Please let me know if it works by giving it a Like or marking it as a solution!


Unlock the secrets to a record-breaking BFCM with PageFly and Canva


➜ Optimize your Shopify store with PageFly Page Builder (Free plan available)


➜ Weekly updated Shopify tutorials on YouTube


All features are available from the Free plan. Live Chat Support is available 24/7.


Michau00
Excursionist
19 0 4

Hi! 

 

Thanks but it's giving me BRACELETS: ["COLOUR BLUE"] now. How can I get rid of those ["?

PageFly-Kate
Shopify Partner
1372 375 425

You can try using my code, this display the tag as "COLOUR BLUE" without the square brackets, and with a space between "COLOUR" and "BLUE".

Please let me know if it works by giving it a Like or marking it as a solution!


Unlock the secrets to a record-breaking BFCM with PageFly and Canva


➜ Optimize your Shopify store with PageFly Page Builder (Free plan available)


➜ Weekly updated Shopify tutorials on YouTube


All features are available from the Free plan. Live Chat Support is available 24/7.