Customizing site maps integration

You can customize site maps integration based on your WebSphere Commerce feature pack version.

Procedure

  • Feature Pack 2WebSphere Commerce Version 7.0.0.0Feature Pack 1Sample site map JSP files are provided and located under the root of each store, for example, WC_eardir/Stores.war. If your store is not customized, use this sample to customize your site maps. If your store is customized, for example you have any URLs that contain additional parameters or if there are new commands or views that are not in the starter stores, you must update the sample site map JSP file in order to generate the correct URLs.

    When the SitemapGenerate command is executed, the following actions are performed:

    1. Writes the content of the rendered JSP file to a temporary location. The command creates a raw site map.
    2. Optional: Validates the content. If the value of the validation_ i parameter is true, the JSP file must contain xsi:schemaLocation; otherwise the command fails. If the validation_i parameter is set to true, a validation check is performed by the predefined command against the defined site map XML schema.

      For example, if we run SitemapGeneratecmd?validation=true&..., and the generated site map contains the schema information that is shown below, the generated site map is validated against the defined schema.

      
      <?xml version='1.0' encoding='UTF-8'?>
       <urlset
      xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
      
      xsi:schemaLocation="http://www.sitemaps.org/schemas/sitemap/0.9 
      http://www.sitemaps.org/schemas/sitemap/0.9/sitemap.xsd"
      xmlns="http://www.sitemaps. org/schemas/sitemap/0.9">
       <url>
       ... 
      </url>
       </urlset>
      
    3. Performs post-processing on the created raw site map, such as splitting a large site map into smaller ones with site map index files. If there is no split, sitemap_storeId.xml.gz is generated. When there is a split, sitemap_storeId.xml.gz is the index file and sitemap_storeId_i.xml.gz are the site map files. The site map files are numbered sequentially.
    4. Validates the created site maps. A site map can be split into smaller pieces plus an index file after post-processing in step 3. Therefore, the validation is repeated to ensure that the split files and the generated index file are valid according to the defined schemas.
    5. Adds the created site maps to the EAR file. The IEARUpdater Java class is called to update the EAR file and the master EAR (collapsed EAR) so that all nodes are updated properly.
  • Introduced in Feature Pack 3Generating site map catalog page URLs does not occur in a JSP file. The URLs are instead generated using the CatalogTreeSiteMapGenerateCmd command. The CatalogTreeSiteMapGenerateCmd command generates the site map catalog page URLs in the XML file. By default, the URLs constructed for products and categories are hierarchical (URL includes category hierarchy), and for top categories, a canonical URL is constructed.

    To customize the site map generation utility so that different URL patterns are constructed for the product and category pages, specify a different URL pattern for products and categories:

    1. Extend the CatalogTreeSiteMapGenerateCmdImpl class and override the following methods to return different URL patterns:
      • For products: getSEOURLPatternNameForCatalogEntry(CatalogNodeDataBean, Integer)
      • For categories: getSEOURLPatternNameForCategory(CatalogNodeDataBean, Integer)
      For example to change the URL pattern used to generate category URLs:
      
        protected String getSEOURLPatternNameForCatalogEntry(CatalogNodeDataBean next, Integer languageId) {
          	return "ProductURLWithParentCategory";
          }
      
      Where ProductURLWithParentCategory is the name of the URL pattern.
    2. Update the entry in the CMDREG table to use the extended catalog tree site map generate class.

      Modify the classname of the interfacename com.ibm.commerce.seo.commands.CatalogTreeSiteMapGenerateCmd, to the name of the extended class, com.mycompany.commerce.seo.sitemap.commands.classname