Shopify themes, liquid, logos, and UX
I'm showing a truncated description on the collection page using this code:
{{ product.description | strip_html | truncate: 170 }}
I'm wondering how I might be able to hide unwanted text - I've seen some blog posts use this:
<!--split-->
But I'm not sure how it translates in this context? The pink arrow shows the text I don't want to appear.
Hi,
what do you mean by "unwanted text"?
Maybe this is helpful: Liquid string filters
@mkamalkayani Thanks - in my original post, you can see I've highlighted some text I don't want to appear. Perhaps it would be good if only the first <p> tag text appeared:
<p>This lightly foaming shampoo helps create and maintain a healthy hair growing environment. It is formulated to revitalize your scalp microbiome and gently remove follicle-clogging sebum.</p>
<!-- split -->
<h5><span>Ingredients</span></h5>
<p>Water (Aqua), Sodium Cocoyl Isethionate, Decyl Glucoside, Cocamidopropyl Hydroxysultaine, Cocamidopropyl Betaine, Cetrimonium Chloride, Glycol Distearate, Phenoxyethanol, Ethylhexylglycerin, Polyquaternum-10</p>
I am sorry, I couldn't understand your question.
I can't provide a good solution unless I have a good understanding of the problem.
You just need to change the code:
{{ product.description | strip_html | remove: "text" | truncate: 170 }}
Ex: {{ product.description | strip_html | remove: "ingredients" | truncate: 170 }}
Hope it helps!
Portrait of Stephen positioned next to an image of planet Earth, with the Stephen's World ...
By JasonH Mar 18, 2024Digital marketers and app developers have tracked activity in apps and websites for yea...
By Ollie Mar 13, 2024February was an exciting month with Shopify Editions, informative webinars, and more! F...
By JasonH Mar 7, 2024