In my newsletter there is a link "view in browser". I want the same web page url on click of this link from which newsletter is created. Like I have published web pages which name are mysite/email.aspx and mysite/email1.aspx,... Each page has common header component. Header Component has a link name like "view in browser". if I click on email1's newsletter "view in browser" link then it should open this page mysite/email.aspx on web. Now how can I got the same url of web page in email in the href of "view in browser" link. Is there any predefined dwt method for this. Please help.
-
3possible duplicate of How to do 'View in Browser' functionality in personalized outbound email ? Any ideas please share– Peter KjaerCommented Feb 18, 2015 at 15:53
-
But in previous question I didn't get the answer that how can I got the current page url of web page in email in the href of "view in browser" link. when we have multiple pages and same header component is used on each page.– AnkitCommented Feb 19, 2015 at 5:08
1 Answer
Check Alvin's answer in the post mentioned by Peter: How to do 'View in Browser' functionality in personalized outbound email ? Any ideas please share
You have a couple of options:
- you can hardcode the url in the page template html (not ideal) or it can be hardcoded in a newletter page metadata field.
add a C# TBB to:
a. Read the website root from publication metadata for instance http://yourwebsite
b. assemble the page path by getting all parent Structure Groups of the page and combining then into a URL string e.g. http://yousite/sg1/sg2/currentnewletterpage.aspx
Publish the newsletter page. Use Dynamic Linking API inside a proxy page to resolve a PageLink instead of ComponentLink. Pass the right URL parameters to that proxy page e.g. http://yoursite/system/pageresolver.aspx?PageUri=tcm:1-123-64 will redirect to the full url of the published newsletter page.
The link can look like this in your newsletter Html:
<a href="http://yoursite/system/pageresolver.aspx?PageUri=@@Page.Id@@"/>View in browser</a>
Create a C# TBB to cleanup the page from any email specifics like merge fields [Name] [Email] etc... to make the page generic as mentioned in the original answer.