Page links

Template developers create Page links as part of a Template, typically to create navigation. For example, a Page Template may contain script code that looks for the index page in the current Structure Group. This link to a Page in Content Manager results in a link to the corresponding Web page on the published Web site (or no link, if there is no such Web page).

The following example shows the code that is generated on a Page before it is viewed, and that the Dynamic Link Resolver uses to resolve the Page link:

<%@ Import namespace="Tridion.ContentDelivery.Web.Linking"%>
<%
  PageLink pageLink = null;
%>
<%
  pageLink = new PageLink();
%>
<!-- A page link -->
<%Response.Write(pageLink.GetLinkAsString("tcm:115-16684","binaryAnchor",
"onClick=\"alert('I am a link')\"","Link for the text",true,""));%>
<!-- end of page link -->
<%
  pageLink.Dispose();
%>

Instead of writing an explicit call to PageLink.GetLinkAsString, you can also use the <tridion:PageLink> Custom Tag or Server Control.