Takes a repository item as input and generates either a static or dynamic URL, depending on whether the page it is on is being viewed by a human visitor or a Web spider.

Class Name

atg.repository.seo.ItemLink

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 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.

Usage Notes

ItemLink 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, 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 Platform Programming Guide.

Example

The following example uses an ItemLink servlet bean to generate URLs on a commerce 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>

Copyright © 1997, 2014 Oracle and/or its affiliates. All rights reserved. Legal Notices