ClassName

atg.repository.seo.ItemLink

Component

(None provided with ATG Adaptive Scenario Engine.)

The ItemLink servlet bean takes a repository item as input and generates either a static or dynamic URL, depending on whether the page it is on is being accessed by a human visitor or a Web spider. ItemLink uses the repository item and information from the request’s HTTP header to determine the type and format of the URL to render.

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

Note: If you embed the ItemLink servlet bean in the Cache servlet bean, you must be sure to create separate cache keys for human visitors and Web spiders (which can be differentiated based on the UserAgent value of the request). Otherwise the page might end up containing the wrong type of URL for the visitor.

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

Input Parameters

item
The actual repository item. If you specify this input parameter, do not use any of the other input parameters.

id
The repository ID of the repository item. If you specify this input parameter, you should also specify the itemDescriptorName parameter and either the repository or the repositoryName parameter.

itemDescriptorName
The name of the item descriptor of the repository item.

repository
The actual repository that contains the item.

repositoryName
The name of the repository that contains the item.

Output Parameters

url
The static or dynamic 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.

empty
Rendered if no template is defined for the browser type.

error
Rendered if a problem occurs when generating the URL.

Example

This example uses an ItemLink component that is included with Pioneer Cycling to generate URLs on a commerce site. The same techniques can be applied to any site.

<dsp:droplet name="/atg/commerce/catalog/CategoryLookup">
  <dsp:param bean="/OriginatingRequest.requestLocale.locale"
    name="repositoryKey"/>
  <dsp:param name="id" param="id"/>
  <dsp:oparam name="output">
    <dsp:droplet name="/atg/repository/seo/CatalogItemLink">
      <dsp:param name="item" param="element"/>
      <dsp:param name="navAction" value="jump"/>
      <dsp:param name="navCount"
        bean="/atg/commerce/catalog/CatalogNavHistory.navCount"/>
      <dsp:oparam name="output">
        <dsp:getvalueof var="finalUrl" vartype="String" param="url">
          <dsp:a href="${finalUrl}">
            <dsp:valueof param="element.displayName"/>
          </dsp:a>
        </dsp:getvalueof>
      </dsp:oparam>
      <dsp:oparam name="error">
          Failed to create URL link to category ID: <dsp:valueof param="id"/>
        <br/><dsp:valueof param="errorMessage"/>
      </dsp:oparam>
    </dsp:droplet>
  </dsp:oparam>
</dsp:droplet>
 
loading table of contents...