Formatting {{ post.summary }} to remove HTML tags

Member | Platinum Partner

have this HubL code: {{ post.summary }}. Which, as you know pulls the summary of each blog post and adds it to wherever I put the HubL, in my case for an email.


However, it doesn't just pull the text, it pulls the the text sits it along with it's CSS. I.e.


<span style="font-size: 1.25rem;">   This text here sits in the blog post.</span>


In emails, I do not want the summary to be font-size: 1.25rem, I want it to be 14px.


<p style="font-size: 14px;">{{ post.summary }}</p>


Since rem unit is relative to the font size of the root element. If an element has its font-size set using that unit, then changing the font-size of its parent element is going to have no effect. Which is why I am wondering if there's a way to modify the content of post.summary instead? I.e. format  {{ post.summary }}  to strip it of any HTML tags?


P.s. Can't use JavaScript since it's for an email.

1 Reply 1
Key Advisor



You can find that in the hubL documenation for filters.


{{ content.post_summary|striptags }}