Component link resolving logic
To resolve a Component link, SDL Tridion Sites looks at the priority settings of Component Templates, and then at the directory hierarchy of the published site (proximity). You can also prevent a Component link from pointing to an exact copy of itself on a different Web page.
Resolving a link using Component Template priorities
A Component will always link to a Component that is rendered with a Component Template of the highest possible priority. You set the priority in Content Manager Explorer as a property of a Component Template. If a Component is used on more than one Page using different Component Templates with different priorities, the generated link will point to the Web page that contains the Component Presentation rendered with the highest-priority Component Template.
A Component Template can have the following values for priority:
- Never link
- Low
- Medium
- High
A link will be generated to a Component that uses a Component Template with the highest priority. In most cases, you will want to assign the highest priority to the Component Template that renders the most Component content. For example, to make a summary Component link to the same Component as a full article, you would assign a Component Template the priority of "Low" or "Never Link" for the summary article, and a priority of "High" for the full Component.
Resolving a link using proximity
If there are multiple Web pages that contain a Component Presentation of the target Component, and all those Component Presentations are rendered with Component Templates of the same, highest priority, then priority cannot be used to determine where the link should point to.
In this case, the proximity of the various target Web pages to the source Web page is used to determine preference: the nearer a target Web page, the more preferred it is as a target. Specifically, links are resolved by looking for target Web pages in the following locations, in the order given:
- If the page that contains the link (the source page) also contains a Component Presentation of the target Component, rendered with the highest priority, the link will point to (a different location on) its own Web page.
- Failing 1, if there is a Web page in the same Web folder as the source page, which contains a Component Presentation of the target Component, rendered with the highest priority, the link will point to that Web page.
- Failing 1 and 2, if there is a Web page in a child Web folder of the source page's Web folder that contains a Component Presentation of the target Component, rendered with the highest priority, the link will point to that Web page.
- Failing 1, 2 and 3, if there is a Web page in the parent Web folder of the source page's Web folder that contains a Component Presentation of the target Component, rendered with the highest priority, the link will point to that Web page.
- Failing 1 through 4, if there is a Web page in a sibling Web folder of the source page's Web folder that contains a Component Presentation of the target Component, rendered with the highest priority, the link will point to that Web page.
- Failing 1 through 5, if there is a Web page in the grandparent Web folder of the source page's Web folder that contains a Component Presentation of the target Component, rendered with the highest priority, the link will point to that Web page.
- Failing 1 through 6, if there is a Web page in a sibling Web folder of the parent Web folder (that is, an 'aunt' or 'uncle' Web folder) of the source page's Web folder that contains a Component Presentation of the target Component, rendered with the highest priority, the link will point to that Web page.
The following diagram show these locations, numbered by descending order of preference.
Resolving a link using Page creation date
It is conceivable that the most preferred location for the link target contains two Web pages that each contain a Component Presentation that render the target Component using Component Templates of the same priority. In this case, the link still cannot be resolved, neither through priority nor through location. In this case, the link will point to the Web page whose corresponding Page in Content Manager was most recently created (regardless of which Web page was published first).
Link resolving example
In the following example (see figure below), a Component is published on two different Pages using a Component Template with the priority "High". Therefore, priority alone is insufficient to determine which Web page to create a link to. Given a source page in directory B, proximity determines which Web page to use as a target. As explained above, a target in a child Web folder (Directory D) is considered preferable to a target in a parent Web folder (Directory A). Therefore, the link on the Web page in Directory B points to the Web page in Directory D.
SDL Tridion World Article: Passing the Page URI to a Dynamic Component Presentation
To learn how you can resolve links by dynamically passing a Page URI to a Dynamic Component Presentation (which by itself has no Page context), refer to the SDL Tridion World article at this URL: https://www.sdltridionworld.com/articles/passing_the_pageURI_to_a_DCP_for_dynamic_linking.aspx