I am trying to build out a hyperlink and want to add target="_blank" only if the link contains http or https in the url? Is there a macro for that?
Example: {% if (BannerImageLink "starts with http or https") {"target=\"_blank\""} %}
{% if (BannerImageLink
) {"target=\"_blank\""} %}
You can do something like this:
<a href="{%BannerImageLink%}"{%if (BannerImageLink.StartsWith("http")) { " target='_blank'"}%}>Link text</a>
Here's a really good article on using the Macro Console.
Thank you so much. that is exactly what I was looking for. And thank for the link too.
Please, sign in to be able to submit a new answer.