I am trying to strip empty <P>
tags from a block of HTML within a Shopify theme. For some reason the remove
filter is not detecting whatever the space character is inside the tag. I’ve even tried copy/pasting from source code into my command and it’s not working.
{{ article.content | remove: '<p> </p>' | remove: '<p> </p>' }}
With this, it still remains:
Copy/paste of the pesky tag:
<p> </p>
3
Answers
replace
Replaces all occurrences of a string with a substring.
I think I found something by copying source code from article editor in Sublime Text.
If you try this (not tested) does it work better?
You can just hide all empty paragraphs with: