Get absolute url for site in email templates

Jon Tetzlaff asked on January 14, 2016 22:15

How do you get the absolute url to your site in an email template? I'm trying to link to images within my email, but not sure how to get the base url. Looks for something like below

<img src="{% CurrentSite.AbsoluteURL #%}getmedia/aee59d16-af69-41af-ab79-0f347e43ecd9/logo.aspx" alt="{% CurrentSite.SiteDisplayName #%}" width="154" height="41" align="left" />

Thanks, Jon

Correct Answer

Brenden Kehren answered on January 14, 2016 22:49

You can use the macro {%RootDocument.AbsoluteURL|(identity)GlobalAdministrator%}. This will get the domain you have entered in the Sites application for the site. So if your Site has localhost in the site domain, it will return http://localhost/. If it has www.domain.com, it will return http://www.domain.com/

4 votesVote for this answer Unmark Correct answer

Recent Answers


Dawid Jachnik answered on January 15, 2016 08:08 (last edited on December 10, 2019 02:30)

Hello,

The macro {%RootDocument.AbsoluteURL|(identity)GlobalAdministrator%} getting domain from current context and if the site has more than one aliases. Does it return domain of the context which is running from?

1 votesVote for this answer Mark as a Correct answer

   Please, sign in to be able to submit a new answer.