6

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.

2 Answers 2

1

One way to solve this is to link to a component that is unique to the View Online page. For this we add a dummy component presentation to the "view online" page, let's call it the "View Online" Component, then link to it from the preheader. The View Online component presentation would not be rendered, it would be there to purely feed the linking.

Another approach would be to create another component template, e.g. "Preheader [email]" - set the priority to Never Link and "Preheader [online]" - set to medium linking priority.

0

You could use

this.linkFactory.ResolveLink(pageUri, fieldSet["viewOnlineLink"].Value, "tcm:0-0-0");

instead; pageUri should be the TCMURI of the context page.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.