Hey, folks!
I'm currently working on developing modules for a new e-mail 2.0 template. I'd like to URL encode content (titles, URLs, descriptions, et cetera) that our marketing team will add to fields on 2.0 modules so that we can include links for Facebook sharer, Tweets, LinkedIn Share Articles, and so on, right in our e-mail templates.
Is there a clever way to URL encode content added to string variable fields, so that we can use some bits of text like this:
To produce an encoded URL, like this:
I'd love to see this as option on the variables themselves when you insert them, so that you can use the same string in multiple places, encoded and unencoded, but I'd settle for redundant fields if I had to.
Solved! Go to Solution.
For variables, no.
You can URL-encode Lead or Company fields (or actually any strings) in Velocity. But variables don't go through that same pipeline.
Okay. Thanks, Sanford! I was afraid of that, but thanks for the quick response.
Variables in emails can get sloppy for this reason. In LPs, the template author can exert control over display (via JS) but in emails the least privileged author has too much control, if you ask me.
You can also bounce all the links off a redirector that does the rewrite. So instead of linking to twitter.com/intent you link to link.agf.com/twtter. Then your page knows to URL-encode its whole query string and pass it to twitter.com.
Thanks, Sanford! Yeah, I've been thinking about other ways we might do it. The site we're linking to has an RSS feed that we could leverage with the descriptions, titles, full URL and a unique numeric key for each article. We could just use that key and build a page to pull info from that feed based on that key and a value automatically appended for each social button, encode the content appropriately, and then redirect the user.
I was hoping we could do it right in the template, but that might not be too bad and would mean the marketing user would only have to provide the title description and key and the rest would be handled by the template and page.