Skip to main content
Solved

Insert HTML code through a property into an email template


Forum|alt.badge.img+3

In my email template, there is a text block, which content is based on a user’s property, let’s call it “description”. The description may or may not contain an HTML link, eg:

<a href="example.com">Example</a>

 and some other plain text. In normal text block, the html is displayed as is, so the user sees the tags and everything.
Is there a way to insert such a user’s property into an email template so that it would be formatted as HTML? So in the given example, user would only see the text “Example”, which would be a link?

Best answer by alex.hong

Hi @piotrekw,

At the moment I believe there is no way to nest an html link into a property since properties are stored as text values.

Apologies for the inconvenience.

View original
Did this topic or the replies in the thread help you find an answer to your question?

6 replies

alex.hong
Forum|alt.badge.img+58
  • Klaviyo Alum
  • 1552 replies
  • August 23, 2022

Hi @piotrekw,

Welcome to the Community.

Just to clarify, are you looking to work with template tags and dynamic syntax? Has this article helped by chance? 

If not, are you looking to add some hyperlink that is labeled a property? Would love to hear more about how this is being implemented in your emails.

 

Thanks,

Alex


Forum|alt.badge.img+3
  • Author
  • Contributor III
  • 5 replies
  • August 24, 2022

Hi @alex.hong 
We have a custom profile variable that usually contains just a plain text.  I wanted to add it to the email template, so I added it into a text block, like so: 

{{ person|lookup:'short_description' }}

But then I realised than in some cases it can also contain some HTML snippets, usually anchor tags. eg:

Lorem ipsum dolor sit amet, <a href="example.com">consectetur</a>

I wonder if there is a way to display it in the email template with the HTML fragments formatted correctly, and not just treated as a plain text.


alex.hong
Forum|alt.badge.img+58
  • Klaviyo Alum
  • 1552 replies
  • August 24, 2022

Hi @piotrekw ,

Thanks for the response.

Are you running into issues when trying to insert the HTML directly into the Source block of your templates? If you are trying to nest an html link within a custom profile property, that might be where we are running into issues. I will look into this matter and report back as well.

 

Thanks,

Alex


Forum|alt.badge.img+3
  • Author
  • Contributor III
  • 5 replies
  • August 25, 2022

Hi @alex.hong 

Yes, I’m trying to nest an html link within a custom profile property, exactly. If you will be able to find any way to do that, that would be great. Thanks!


alex.hong
Forum|alt.badge.img+58
  • Klaviyo Alum
  • 1552 replies
  • Answer
  • August 26, 2022

Hi @piotrekw,

At the moment I believe there is no way to nest an html link into a property since properties are stored as text values.

Apologies for the inconvenience.


Forum|alt.badge.img+3
  • Author
  • Contributor III
  • 5 replies
  • August 29, 2022

Hi @alex.hong ,
yes, it seems so. For now I’ve started detecting HTML in those texts and removing it before pushing to Klaviyo. Thanks for help :)