In our DD4T application, I have two pages. The first page is used to render HTML emails, so the layout if table driven. The second page will eventually be used to render the responsive HTML version of the email. Right now, however, the second page uses the exact same component presentations as the first page, with one exception---the first page contains a "pre-header" component.
The pre-header component contains a "View Online" link. This link will redirect the user to the "web-friendly" version from inside their email client. The "View Online" link is associated with the "Header" component. In the code that builds my DD4T view model, the link is resolved using the following code:
this.linkFactory.ResolveLink(fieldSet["viewOnlineLink"].Value);
The issue is that the resolved link is always the current page. Here's the output from the link log file:
ComponentLink.getLink(): start retrieving pathinfo for this page: 506 ComponentLink.getLink(): componentLinkInfo.getPageId()<>sourcePageId=505=506 Path to source page is: /Campaign/Newsletter Path to found page is :/Campaign/Newsletter Score found is 0 ComponentLink.getLink(): componentLinkInfo.getPageId()<>sourcePageId=506=506 Found component link on same page, page URL: /Campaign/Newsletter/newsletter_black_email.aspx ComponentLink.getLink(): found a target page, using PageLink to link to page: 506 ComponentLink.getLink(): Anchor: null PageLink.getLink(...) called to resolve link for page: 506 2014-07-11 11:52:51,479 DEBUG PageLink - PageLink.getLink(...) got URL from PageMetaData: /Campaign/Newsletter/newsletter_black_email.aspx PageLink - PageLink.getLink(...) returning link: <a href="/Campaign/Newsletter/newsletter_black_email.aspx">
Basically, I want to exclude the current page from the link resolver.