To set up the sitemap generation process, you must create and configure:

Configuring the SitemapGeneratorService

The atg.sitemap.SitemapGeneratorService class manages the process of generating sitemaps and sitemap indexes. The Oracle Commerce Platform includes a component of this class, /atg/sitemap/SitemapGeneratorService. To configure a SitemapGeneratorService component, set the following properties:

Property

Description

sitemapGenerators

An array of components of classes that implement the atg.sitemap.SitemapGenerator interface. Typically this is a mix of components of class atg.sitemap.StaticSitemapGenerator and components of class atg.sitemap.DynamicSitemapGenerator.

sitemapIndexGenerator

A component of class atg.sitemap.SitemapIndexGenerator.

sitemapRepository

The repository that stores the sitemaps and the sitemap index. This should be set to /atg/sitemap/SitemapRepository.

sitemapPropertiesManager

A component that maps properties in the SitemapRepository to the names used in Java code. This should be set to /atg/sitemap/SitemapPropertiesManager.

sitemapTools

A component with utility methods for looking up and modifying items in the SitemapRepository. This should be set to /atg/sitemap/SitemapTools.

maxUrlsPerSitemap

The maximum number of URLs to be stored in a single sitemap file. If this property is not set explicitly, it defaults to 50000, the maximum allowed by sitemap.org.

maxSitemapSize

Maximum size of a single sitemap file, in bytes. If this property is not set explicitly, it defaults to 10485760 (10 Mb), the maximum allowed by sitemap.org.

urlPrefix

String to prepend to the URL entries produced by the generator components. This property is not actually used by the SitemapGeneratorService itself, but you can set it here and then set the corresponding property of the generator components by linking to this value.

webApp

The Nucleus pathname for the component of class atg.service.webappregistry.WebApp that represents the web application that the sitemap is generated for. This property is not actually used by the SitemapGeneratorService itself, but you can set it here and then set the corresponding property of the generator components by linking to this value.

warDir

The operating-system pathname of the deployed WAR file that the sitemap is generated for. This property is not actually used by the SitemapGeneratorService itself, but you can set it here and then set the corresponding property of the generator and writer components by linking to this value.

There are additional properties that need to be configured for a multisite application. See Additional Configuration for Multisite Applications.

In addition to these sitemap-related properties, SitemapGeneratorService also has several properties it inherits from atg.service.scheduler.SingletonSchedulableService. See Invoking Sitemap Generation and Writing for more information.

A properties file for a SitemapGeneratorService component might look like this:

$class=atg.sitemap.SitemapGeneratorService
$scope=global

schedule=calendar * * . . 1 .
scheduler=/atg/dynamo/service/Scheduler
clientLockManager=/atg/dynamo/service/ClientLockManager
lockName=SitemapGeneratorService

sitemapGenerators=\
     /atg/sitemap/ProductSitemapGenerator,\
     /atg/sitemap/CategorySitemapGenerator,\
     /atg/sitemap/StaticSitemapGenerator
sitemapIndexGenerator=/atg/sitemap/SitemapIndexGenerator

sitemapRepository=/atg/sitemap/SitemapRepository
sitemapPropertiesManager=/atg/sitemap/SitemapPropertiesManager
sitemapTools=/atg/sitemap/SitemapTools

maxUrlsPerSitemap=10000
maxSitemapSize=5000000
Configuring the StaticSitemapGenerator

The atg.sitemap.StaticSitemapGenerator class generates sitemaps for static pages. This class has a staticPages property that you use to specify a list of static pages to be included in the sitemap. For example:

staticPages=/index.jsp,\
            /support/contact.jsp,\
            /company/news.jsp,\
            /company/aboutUs.jsp

The entries in the list can use wildcards in the following ways:

The StaticSitemapGenerator class has changeFrequency and priority properties for setting the default values of the <changefreq> and <priority> tags for each URL in the static pages sitemap. You can override these values for an individual page or group of pages by explicitly setting the values in the entry for the page or pages, as in this example:

staticPages=/index.jsp,\
            /support/contact.jsp:monthly:0.8,\
            /company/*.jsp:weekly

To configure a StaticSitemapGenerator component, set the following properties:

Property

Description

changeFrequency

The default value to use for the <changefreq> tag for each URL. This value can be overridden for specific pages in the staticPages property (see above).

priority

The default value to use for the <priority> tag for each URL. This value can be overridden for specific pages in the staticPages property (see above).

staticPages

A list of static pages to be included in the sitemap (see above).

sitemapFilePrefix

A String used to form the names of the static sitemap files. If a single file is generated, .xml is appended to this String to form the filename (e.g., if sitemapFilePrefix=staticSitemap, the resulting filename is staticSitemap.xml). If multiple files are generated (because the maximum number of URLs or maximum file size is exceeded), 2.xml, 3.xml, and so on are appended to the second and subsequent files (e.g., staticSitemap2.xml, staticSitemap3.xml, etc.). Note that the value of sitemapFilePrefix must be unique for each sitemap generator component, to prevent overwriting of files.

urlPrefix

String to prepend to the filenames found using staticPages to form the URL entries included in the sitemap. This should include the protocol, domain, and port (if needed). If the webApp property is null, urlPrefix should also include the context root; for example:

http://www.example.com/mywebapp/

webApp

The Nucleus pathname for the component of class atg.service.webappregistry.WebApp that represents the web application that the sitemap is generated for; for example:

/atg/registry/webappregistry/MyWebApp

The StaticSitemapGenerator examines the web application to find the context root to append to urlPrefix. If you include the context root in urlPrefix, leave webApp null.

warDir

The operating-system pathname of the deployed WAR file that the sitemap is generated for; for example:

C:\jboss-eap-6.1\standalone\deployments\atg_production\
atg_production.ear\mywebapp.war

The StaticSitemapGenerator looks in this directory for files that match the patterns specified in the staticPages property.

Configuring the DynamicSitemapGenerator

The atg.sitemap.DynamicSitemapGenerator class generates sitemaps for dynamic pages. This class uses a URL template to translate dynamic URLs to static URLs for inclusion in the sitemaps. For example, suppose the URL for a product detail page looks like this:

http://mywebsite.com/mywebapp/productDetail.jsp?productId=id

DynamicSitemapGenerator iterates through all of the product repository items in the ProductCatalog repository and for each item generates a static URL, such as:

http://mywebsite.com/mywebapp/jump/product/12345/Oxford+Shirt/

See the Using URL Templates section for more information about URL templates.

To configure a DynamicSitemapGenerator component, set the following properties:

Property

Description

changeFrequency

The value to use for the <changefreq> tag for each URL.

priority

The value to use for the <priority> tag for each URL.

sourceRepository

The repository whose items are used to construct the dynamic sitemap URLs. For example, for a Core Commerce site, this is typically /atg/commerce/catalog/ProductCatalog.

itemDescriptorName

The name of the type of item to retrieve from the source repository to use for constructing URLs. For example, for a product detail page on a Core Commerce site, this would typically be product. Note that an individual DynamicSitemapGenerator component can use only a single item type, so if you want your sitemap to include pages based on different item types (e.g., product pages and category pages), you need to configure a separate DynamicSitemapGenerator for each item type.

transactionManager

The transaction manager to use. Typically /atg/dynamo/transaction/TransactionManager.

numberOfItemsPerTransaction

The number of repository items to process in each transaction.

template

A URL template component that translates URLs for inclusion in sitemaps. Typically this is a component of class atg.repository.seo.IndirectUrlTemplate, which translates dynamic URLs to their static equivalents. See Using URL Templates for more information.

sitemapFilePrefix

A String used to form the names of the dynamic sitemap files. If a single file is generated, .xml is appended to this String to form the filename (e.g., if sitemapFilePrefix=dynamicSitemap, the resulting filename is dynamicSitemap.xml). If multiple files are generated (because the maximum number of URLs or maximum file size is exceeded), 2.xml, 3.xml, and so on are appended to the second and subsequent files (e.g., dynamicSitemap2.xml, dynamicSitemap3.xml, etc.). Note that the value of sitemapFilePrefix must be unique for each sitemap generator component, to prevent overwriting of files.

urlPrefix

String to prepend to the URLs created by the URL template. This should include the protocol, domain, and port (if needed). If the webApp property is null, urlPrefix should also include the context root; for example:

http://www.example.com/mywebapp/

webApp

The Nucleus pathname for the component of class atg.service.webappregistry.WebApp that represents the web application that the sitemap is generated for; for example:

/atg/registry/webappregistry/MyWebApp

The DynamicSitemapGenerator examines the web application to find the context root to append to urlPrefix. If you include the context root in urlPrefix, leave webApp null.

Configuring the SitemapIndexGenerator

The atg.sitemap.SitemapIndexGenerator class generates sitemap indexes. This class creates a sitemap index containing a list of all of the sitemap files generated by the corresponding SitemapGenerator components.

To configure a SitemapIndexGenerator component, set the following properties:

Property

Description

siteIndexFilename

The name of the generated sitemap index file; for example, sitemap.xml.

urlPrefix

String to prepend to the sitemap filenames to form the URL entries included in the sitemap index. This should include the protocol, domain, and port (if needed). If the webApp property is null, urlPrefix should also include the context root; for example:

http://www.example.com/mywebapp/

webApp

The Nucleus pathname for the component of class atg.service.webappregistry.WebApp that represents the web application that the sitemap is generated for; for example:

/atg/registry/webappregistry/MyWebApp

The SitemapIndexGenerator examines the web application to find the context root to append to urlPrefix. If you include the context root in urlPrefix, leave webApp null.


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