Solved

Insert HTML code through a property into an email template

  • 23 August 2022
  • 6 replies
  • 437 views

Badge +2

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?

icon

Best answer by alex.hong 26 August 2022, 22:12

View original

6 replies

Userlevel 7
Badge +58

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

Badge +2

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.

Userlevel 7
Badge +58

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

Badge +2

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!

Userlevel 7
Badge +58

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.

Badge +2

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 :)

Reply