For ATG-driven pages, the application detects whether the site visitor is a web spider, and if it is, generates static URLs for links to pages, rather than the dynamic URLs that the ATG platform typically uses. For example, the static URL for a product detail page might look similar to this:
http://www.example.com:80/crs/storeus/jump/Crystal+Decanter/productDetail/
Glassware/xprod2081/cat10024
This URL results in a higher ranking for the search term “Crystal Decanter” than the equivalent dynamic URL, which looks similar to this:
http://www.example.com:80/crs/storeus/browse/productDetailSingleSku
.jsp?
productId=xprod2081&categoryId=cat10024
To implement the URL recoding feature, Commerce Reference Store includes ATG components that:
Detect whether a site visitor is a spider or not.
Render either static URLs or dynamic URLs, depending on the type of visitor.
Specify how to translate dynamic URLs to their static equivalents.
In addition, Commerce Reference Store includes ATG components that translate static URLs in incoming requests (issued when the customer clicks a link returned by a Web search engine) to the dynamic URLs that the ATG platform understands.
These components are described below.
ItemLink and BrowserTyperDroplet Servlet Beans
The atg.repository.seo.ItemLink
servlet bean takes a repository item as input and uses a URL template to construct a link to a page displaying that item. ItemLink
examines the HTTP request’s User-Agent
property and creates either a static or dynamic URL, depending on whether the site visitor is a web spider or not.
Commerce Reference Store includes two ItemLink
components, CatalogItemLink
and ProductLookupItemLink
, and their associated template mapper and template components. All of these components are found in the /atg/repository/seo/
Nucleus folder.
Commerce Reference Store also uses the atg.repository.seo.BrowserTyperDroplet
servlet bean to determine if a site visitor is a web spider, and uses this information on the page when caching page content and adding parameters to links. Commerce Reference Store includes a component of this class, /atg/repository/seo/BrowserTyperDroplet
, whose browserTypes
property is set to robot
. BrowserTyperDroplet
examines the current request, and if it determines that the source of the request is a robot or spider, it sets its browserType
output parameter to robot
; otherwise it sets it to other
.
CatalogItemLink Component
The CatalogItemLink
component is the main instance of the ItemLink
servlet bean used by Commerce Reference Store. This component is configured as follows:
itemDescriptorNameToMapperMap=\ product=/atg/repository/seo/ProductTemplateMapper defaultRepository=/atg/commerce/catalog/ProductCatalog defaultItemDescriptorName=product siteManager=/atg/multisite/SiteManager
The itemDescriptorNameToMapperMap
property determines the template mapper to use, based on the type of repository item passed to the servlet bean. The product
item type (for links to product detail pages) is mapped to the /atg/repository/seo/ProductTemplateMapper
component. (No mapping is provided for the category
item type, because category pages are Endeca-driven.)
Each template mapper component has a templates
property that specifies one or more templates to use for rendering static URLs, and a defaultTemplate
property that specifies the template to use for rendering dynamic URLs. The templates
property of the ProductTemplateMapper
component is set to /atg/repository/seo/ProductIndirectTemplate
. This template is used to construct static URLs for product detail pages if the site visitor is a spider.
The urlTemplateFormat
property of ProductIndirectTemplate
, which specifies the format of static URLs for product detail pages, is set to:
/jump/{item.displayName}/productDetail/{item.parentCategory.displayName}/
{item.id}/{item.parentCategory.id}/{locale}
The resulting URL thus includes the display name of the product and its default parent category, so Web search engines can index these terms. In addition, it includes the repository IDs of the product and category. These IDs, along with the /jump
prefix, enable the SEO jump servlet to reconstruct the dynamic URL, as discussed in Translating Static URLs.
ProductLookupItemLink Component
When the CatalogItemLink
component constructs a static URL for a product detail page, it determines the category to use in the URL by looking up the product’s default parent category. But if the product has multiple parent categories, and is being accessed in a category that is not the default parent, using the default parent category in the URL may not be the desired behavior.
To handle this situation, Commerce Reference Store includes another instance of the ItemLink
servlet bean, ProductLookupItemLink
. This component is used for generating links to product detail pages in cases where a product is not being viewed in its default category. Its itemDescriptorNameToMapperMap
property is configured as follows:
itemDescriptorNameToMapperMap=\
product=/atg/repository/seo/ProductLookupTemplateMapper
The templates
property of the ProductLookupTemplateMapper
component is set to /atg/repository/seo/ProductLookupIndirectTemplate
. The urlTemplateFormat
property of this template is set to:
/jump/{item.displayName}/productDetail/{item.parentCategory.displayName}/
{item.id}/{categoryId}/{locale}
The resulting URL includes the display name of the default parent category, but rather than the default parent category’s ID, it instead includes the ID of the category that the product is being accessed from. This enables the Web search engine to associate the product with its default category in its index, while still allowing the SEO jump servlet to reconstruct the dynamic URL specifying the (non-default) category that the product was accessed from. The ProductLookupIndirectTemplate
can obtain the category ID of the non-default parent category from a page parameter, or it can be explicitly set on the page.
Translating Static URLs
When a spider visits a Commerce site that uses URL recoding, the site renders static URLs for pages the spider accesses. These static URLs are used as links in results returned by the Web search engine, but they are not actually valid URLs on Commerce sites. So when a user clicks one of these links, the site must examine the request and translate it into a dynamic URL that can be interpreted by the ATG request-handling components. This translation is done by the SEO jump servlet, which is declared in the store.war/WEB-INF/web.xml
file as a URI-mapped servlet:
<servlet> <servlet-name>MappedJumpServlet</servlet-name> <servlet-class> atg.repository.seo.MappedJumpServlet </servlet-class> <init-param> <param-name>loggingDebug</param-name> <param-value>true</param-value> </init-param> <init-param> <param-name>jumpServlet</param-name> <param-value> ctx:dynamo:/atg/dynamo/servlet/dafpipeline/JumpServlet </param-value> </init-param> </servlet> ... <servlet-mapping> <servlet-name>MappedJumpServlet</servlet-name> <url-pattern>/jump/*</url-pattern> </servlet-mapping>
The servlet’s templates
property, which lists the indirect URL templates used to determine how to translate the URL, is set to:
templates=\
/atg/repository/seo/ProductIndirectTemplate
Properties of the ProductIndirectTemplate
component specify regular expression patterns that the servlet uses to parse static URLs and translate them to their dynamic equivalents. See the Search Engine Optimization chapter of the Platform Programming Guide for more information.