Takes a repository item as input and generates the canonical URL for the page associated with that item.

Class Name

atg.repository.seo.CanonicalItemLink

Component

Not provided with the ATG platform

Required Input Parameters

Specify the repository item with one of the following input parameters:

item

The target repository item.

id

The repository ID of the target repository item. If you specify this input parameter, also specify two additional parameters:

itemDescriptorName

The repository item’s item descriptor.

repository

The repository that contains the item.

repositoryName

The name of the repository that contains the item.

Output Parameters

url

The canonical URL generated by the servlet bean.

errorMessage

The error message produced if a problem occurs generating the URL.

Open Parameters

output

Rendered if the URL is generated successfully.

error

Rendered if a problem occurs when generating the URL.

Usage Notes

CanonicalItemLink takes a repository item as input and generates the canonical URL for the page associated with that item.

You can specify the repository item in one of two ways:

For more information about CanonicalItemLink, see the discussion of Search Engine Optimization in the ATG Platform Programming Guide.

Example

The following example illustrates using a CanonicalItemLink servlet bean on a product detail page to render a link tag specifying the page’s canonical URL.

<dsp:droplet name="/atg/repository/seo/CanonicalItemLink">
  <dsp:param name="id" param="productId"/>
  <dsp:param name="itemDescriptorName" value="product"/>
  <dsp:param name="repositoryName"
     value="/atg/commerce/catalog/ProductCatalog"/>
  <dsp:oparam name="output">
    <dsp:getvalueof var="pageUrl" param="url" vartype="java.lang.String"/>
    <link rel="canonical" href="${pageUrl}"/>
 </dsp:oparam>
</dsp:droplet>