To set up the sitemap generation process, you must create and configure:
One
SitemapGeneratorServicecomponentOne or more
StaticSitemapGeneratorcomponentsOne or more
DynamicSitemapGeneratorcomponentsOne
SitemapIndexGeneratorcomponentOne
SitemapWriterServicecomponent on each page-serving ATG instance
Configuring the SitemapGeneratorService
The atg.sitemap.SitemapGeneratorService class manages the process of generating sitemaps and sitemap indexes. The ATG platform includes a component of this class, /atg/sitemap/SitemapGeneratorService. To configure a SitemapGeneratorService component, set the following properties:
sitemapGenerators
An array of components of classes that implement theatg.sitemap.SitemapGeneratorinterface. Typically this is a mix of components of classatg.sitemap.StaticSitemapGeneratorand components of classatg.sitemap.DynamicSitemapGenerator.
sitemapIndexGenerator
A component of classatg.sitemap.SitemapIndexGenerator.
sitemapRepository
The repository that stores the sitemaps and the sitemap index. This should be set to/atg/sitemap/repository/SitemapRepository.
sitemapPropertiesManager
A component that maps properties in theSitemapRepositoryto the names used in Java code. This should be set to/atg/sitemap/repository/SitemapPropertiesManager.
sitemapTools
A component with utility methods for looking up and modifying items in theSitemapRepository. This should be set to/atg/sitemap/repository/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 bysitemap.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 bysitemap.org.
urlPrefix
String to prepend to the URL entries produced by the generator components. This property is not actually used by theSitemapGeneratorServiceitself, 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 classatg.service.webappregistry.WebAppthat represents the web application that the sitemap is generated for. This property is not actually used by theSitemapGeneratorServiceitself, 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 theSitemapGeneratorServiceitself, but you can set it here and then set the corresponding property of the generator and writer components by linking to this value.
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/repository/SitemapRepository sitemapPropertiesManager=/atg/sitemap/repository/SitemapPropertiesManager sitemapTools=/atg/sitemap/repository/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:
A single asterisk (
*) matches a filename of any length in the specified directory, but does not include files in subdirectories. For example,/company/*.jspmatches any JSP file in the/company/directory, but not in the/company/about/subdirectory..Two asterisks (
**) match subdirectories to any depth. For example,/company/**/*.jspmatches any JSP file in the/company/directory or any subdirectory of it.A question mark (
?) matches any single character in a filename. For example,/company/news?.jspmatchesnews1.jsp,news2.jsp, etc., in the/company/directory.
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:
changeFrequency
The default value to use for the<changefreq>tag for each URL. This value can be overridden for specific pages in thestaticPagesproperty (see above).
priority
The default value to use for the<priority>tag for each URL. This value can be overridden for specific pages in thestaticPagesproperty (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 dynamic sitemap files. If a single file is generated,.xmlis appended to this String to form the filename (e.g., ifsitemapFilePrefix=dynamicSitemap, the resulting filename isdynamicSitemap.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 ofsitemapFilePrefixmust be unique for each sitemap generator component, to prevent overwriting of files.
urlPrefix
String to prepend to the filenames found usingstaticPagesto form the URL entries included in the sitemap. This should include the protocol, domain, and port (if needed). If thewebAppproperty is null,urlPrefixshould also include the context root; for example:http://www.example.com/mywebapp/
webApp
The Nucleus pathname for the component of classatg.service.webappregistry.WebAppthat represents the web application that the sitemap is generated for; for example:/atg/registry/webappregistry/MyWebApp
TheStaticSitemapGeneratorexamines the web application to find the context root to append tourlPrefix. If you include the context root inurlPrefix, leavewebAppnull.
warDir
The operating-system pathname of the deployed WAR file that the sitemap is generated for; for example:C:\jboss-eap-4.2\jboss-as\server\atg\deploy\ATG.ear\mywebapp.war
TheStaticSitemapGeneratorlooks in this directory for files that match the patterns specified in thestaticPagesproperty.
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=idDynamicSitemapGenerator 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 URL Templates section for more information about URL templates.
To configure a DynamicSitemapGenerator component, set the following properties:
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 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 Commerce site, this would typically beproduct. Note that an individualDynamicSitemapGeneratorcomponent 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 separateDynamicSitemapGeneratorfor each item type.
transactionManager
The transaction manager to use. Typically/atg/dynamo/transaction/TransactionManager.
template
A URL template component that translates URLs for inclusion in sitemaps. Typically this is a component of classatg.repository.seo.IndirectUrlTemplate, which translates dynamic URLs to their static equivalents. See URL Templates for more information.
sitemapFilePrefix
A String used to form the names of the dynamic sitemap files. If a single file is generated,.xmlis appended to this String to form the filename (e.g., ifsitemapFilePrefix=dynamicSitemap, the resulting filename isdynamicSitemap.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 ofsitemapFilePrefixmust 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 thewebAppproperty is null,urlPrefixshould also include the context root; for example:http://www.example.com/mywebapp/
webApp
The Nucleus pathname for the component of classatg.service.webappregistry.WebAppthat represents the web application that the sitemap is generated for; for example:/atg/registry/webappregistry/MyWebApp
TheDynamicSitemapGeneratorexamines the web application to find the context root to append tourlPrefix. If you include the context root inurlPrefix, leavewebAppnull.
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:
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 thewebAppproperty is null,urlPrefixshould also include the context root; for example:http://www.example.com/mywebapp/
webApp
The Nucleus pathname for the component of classatg.service.webappregistry.WebAppthat represents the web application that the sitemap is generated for; for example:/atg/registry/webappregistry/MyWebApp
TheSitemapIndexGeneratorexamines the web application to find the context root to append tourlPrefix. If you include the context root inurlPrefix, leavewebAppnull.

