SOLVED

How do I make anchor links work in an email?

Go to solution
Jimmy_Hang
Level 2

Hi - I am setting up an email which includes 4 links to specific parts of a landing page. 3 out of 4 anchor links work, but the 4th one won't work - I get a validation error when I try to approve the email. All 4 links go to the same page, just different sections with a hashtag

1 ACCEPTED SOLUTION
SanfordWhiteman
Level 10 - Community Moderator

A-ha, URL-encode the "e" to avoid the reparsing error:

<a href="https://plaid.com/legal/#%65nd-user-privacy-policy" target="_blank" class="mktNoTrack" id="">End User Privacy Policy</a>

Some browsers will display the "%65" as "e" in the location bar, others will keep it as "%65", but the anchor link works either way.

View solution in original post

18 REPLIES 18
SanfordWhiteman
Level 10 - Community Moderator

Well, you haven't shown an actual example, so it's impossible to know for sure, but you should replace

 

#

in your URLs with

 

${esc.h}
Jimmy_Hang
Level 2

Thanks for the help, Sanford! I tried what you suggested and got a different error now - see belowScreen Shot 2019-12-23 at 9.16.25 AM.png

The original link I am trying to include is this: https://plaid.com/legal/#end-user-privacy-policy 

SanfordWhiteman
Level 10 - Community Moderator

That link definitely needs the escape character as indicated. #end is a reserved word and can't be used literally.

Please show the part of the HTML where you subbed in the escape character. (Show the whole <a> tag, including closing </a>.)

Jimmy_Hang
Level 2

<a href="https://plaid.com/legal/${esc.h}end-user-privacy-policy" target="_blank" class="mktNoTrack">End Use Privacy Policy</a>

SanfordWhiteman
Level 10 - Community Moderator

Can you create an email with only that link (with the escaped character like you have it) and test again?

Jimmy_Hang
Level 2

Just did it and getting the same error

Jimmy_Hang
Level 2

Correct - I tried a plain text email and one using a template

SanfordWhiteman
Level 10 - Community Moderator

OK, let me look try to repro this.

Jimmy_Hang
Level 2

Thank you Sanford!

SanfordWhiteman
Level 10 - Community Moderator

Yep, definitely confusing behavior. The reserved word still gets flagged even when double-escaped.

The reason is that Marketo recursively parses content as Velocity. So "disguising" the few VTL reserved words is difficult, maybe impossible (though I'll keep testing it). Eventually, the parser sees a literal #end.

In future, though I know it can be hard to coordinate this with the web team, avoid using reserved words in your hash: there are only a few (#if #else #elseif #end #set #foreach #define #macro #include #parse #break #stop #evaluate).

Jimmy_Hang
Level 2

Thanks for looking into this, Sanford - I will follow your guidance and have our WebDev team eventually update our website to avoid those terms.

SanfordWhiteman
Level 10 - Community Moderator

A-ha, URL-encode the "e" to avoid the reparsing error:

<a href="https://plaid.com/legal/#%65nd-user-privacy-policy" target="_blank" class="mktNoTrack" id="">End User Privacy Policy</a>

Some browsers will display the "%65" as "e" in the location bar, others will keep it as "%65", but the anchor link works either way.

Jimmy_Hang
Level 2

Amazing, it works! Thanks so much Sanford for all the help!

SanfordWhiteman
Level 10 - Community Moderator

Cool, gonna add it to the blog. Can you mark my answer as Correct?

Jimmy_Hang
Level 2

Done - thanks again

SanfordWhiteman
Level 10 - Community Moderator
Jimmy_Hang
Level 2

Nice post! Thanks again

SanfordWhiteman
Level 10 - Community Moderator

To be clear, this new email has only the link (no other content)?