8

I have a DCP with Allow on Page Using Dynamic Assembly checked which I am storing in the database. This DCP is a summary display of a component, and it contains a component link to another component presentation using the same component on a different page. I have the Output Format set to REL so that the dynamic link will be resolved at runtime.

Everything generally works, <tcdl:Link> tags make it into the COMPONENT_PRESENTATIONS table and are resolved when the page is rendered. However since this DCP is used on multiple pages I cannot set the origin attribute on the tcdl:link tag during publish. I know this means the link resolution will not be cached, it also results in a page linking to itself sometimes. I reviewed some posts, including this one by Mihai (Passing the PageURI to a DCP for Dynamic Linking) but that only applies to DCPs stored in the file system. I know I can set template priority to solve this problem in this particular instance by making the detail CP higher priority but I'm wondering if there is a way to use the origin attribute properly in this situation.

Additional Information:

I am using Razor mediator for templating, ASP.NET for delivery, pages and binaries are stored in the file system with everything else in the DB.

My link tag as it exists in the COMPONENT_PRESENTATIONS table:

<tcdl:Link type="Component" origin="tcm:0-0-0" destination="tcm:42-215" templateURI="tcm:0-0-0" linkAttributes=" title=&quot;Available content component types&quot;" textOnFail="true" addAnchor="false" variantId="">Available content component types</tcdl:Link>

Thanks.

1
  • Publication Target Language is ASP.NET
    – Nate Niemi
    Mar 7, 2014 at 18:27

1 Answer 1

3

Looks like you have a classic "index page with summaries/teasers pointing to detailed article pages".

My understanding is that the origin attribute is there to exclude the current page from the Dynamic Linking algorithm, i.e. it is the URI of the page that list the dynamic link (this page). But when you're rendering a DCP used in multiple pages linking to another DCP also used on multiple pages, you have multiple origin values. So this can't be done and Tridion sets the value to "tcm:0-0-0" because that's the best it can do.

What you can do is set the summary CT to not be a Dynamic template. So render it statically on your index/summary page, and you should be able to specify the origin then.

5
  • Any advice on the caching? I'd like to use a DCP from the database for the header, it would likely have a good amount of component links and obviously be loaded frequently. I guess maybe switching to a ascx is my only option.
    – Nate Niemi
    Mar 7, 2014 at 18:29
  • 3
    When the origin is "tcm:0-0-0" this link will not be cached. If cache is the only concern, then I'd consider "hard-coding" the URI of the home page as origin. If distance to the actual is page is important, then you may need something more creative - perhaps you can get the current page ID from the Ambient Framework (speculating here, but maybe others can pitch in on this idea).
    – Nuno Linhares
    Mar 7, 2014 at 18:37
  • Instead of a DCP, you can make your header an include page published from Tridion (or publish a page with an ascx extension). Then you'd have one TCM URI for this page and use the origin. (P.S. play the Stackexchange game and upvoate - we help in exchange for points :) Mar 7, 2014 at 20:39
  • Ha, I don't have enough rep to upvote yet. It sounds like the answer is no and I just don't get to use the origin attribute in this situation. I've got a lot of options to work around it so I will use one of those. Thanks for the comments.
    – Nate Niemi
    Mar 7, 2014 at 20:51
  • 1
    No problem, then stick around. Ask, contribute and you'll have some rep in no time. Glad you have thought through workarounds. Sounds like you know what to do. Good luck! Mar 8, 2014 at 0:46

Your Answer

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

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