Script: Class dw.sitemap.SitemapMgr

Class SitemapMgr

SitemapMgr is used to access and modify custom sitemap files.

To access custom sitemap files, use methods getCustomSitemapFiles().

To delete custom sitemap files, use methods deleteCustomSitemapFile(SitemapFile), deleteCustomSitemapFiles(String) and deleteCustomSitemapFiles().

To add custom sitemap files, use methods addCustomSitemapFile(String, File). The file will be copied from WebDAV (File represent a file in WebDAV) to the appservers shared file system.

Please note that all provided methods are operating in appservers shared file system. These modifications are visible via "Custom Sitemaps" tab under Merchant Tools => SEO => Sitemaps - Custom Sitemaps in Business Manager. To publish all changes, the system job "Create Sitemap Schedule" must be executed afterwards.

Properties

customSitemapFiles : Map Read Only

Reads all existing custom sitemap files from files system of the appservers custom sitemap directory into memory and returns them in a Map containing mappings like

  • Hostname 1 => [SitemapFile hostname1_sitemapfile1, SitemapFile hostname1_sitemapfile2]
  • Hostname 2 => [SitemapFile hostname2_sitemapfile1]

Constructor Summary

This class does not have a constructor, so you cannot create it directly.

Method Summary

static addCustomSitemapFile(hostName : String, file : File) : void

Adds the given File to the appservers custom sitemap directory.

static deleteCustomSitemapFile(sitemapFile : SitemapFile) : void

Deletes the given custom sitemap file from the appservers shared file system.

static deleteCustomSitemapFiles(hostName : String) : void

Deletes all custom sitemap files for the given hostname from the appservers shared file system.

static deleteCustomSitemapFiles() : void

Deletes all custom sitemap files for all hostnames from the appservers shared file system.

static getCustomSitemapFiles() : Map

Reads all existing custom sitemap files from files system of the appservers custom sitemap directory into memory and returns them in a Map containing mappings like

  • Hostname 1 => [SitemapFile hostname1_sitemapfile1, SitemapFile hostname1_sitemapfile2]
  • Hostname 2 => [SitemapFile hostname2_sitemapfile1]

Methods inherited from class Object

assign, create, create, defineProperties, defineProperty, entries, freeze, fromEntries, getOwnPropertyDescriptor, getOwnPropertyNames, getOwnPropertySymbols, getPrototypeOf, hasOwnProperty, is, isExtensible, isFrozen, isPrototypeOf, isSealed, keys, preventExtensions, propertyIsEnumerable, seal, setPrototypeOf, toLocaleString, toString, valueOf, values

Method Detail

addCustomSitemapFile

static addCustomSitemapFile(hostName : String, file : File) : void

Adds the given File to the appservers custom sitemap directory. All content of the appservers custom sitemap directory is considered by the system job "Create Sitemap Schedule".

The files are added to the directory which is accessible via "Custom Sitemaps" tab under Merchant Tools => SEO => Sitemaps - Custom Sitemaps in Business Manager. To publish that change, the system job "Create Sitemap Schedule" must be executed afterwards.

Parameters:

hostName - The hostName to copy the File to. The hostName must be configured in sites alias file.

file - The File to copy.

Throws:

- Exception

deleteCustomSitemapFile

static deleteCustomSitemapFile(sitemapFile : SitemapFile) : void

Deletes the given custom sitemap file from the appservers shared file system.

The file is deleted from the directory which is accessible via "Custom Sitemaps" tab under Merchant Tools => SEO => Sitemaps - Custom Sitemaps in Business Manager. To publish that change, the system job "Create Sitemap Schedule" must be executed afterwards.

Parameters:

sitemapFile - - The sitemapFile to delete.


deleteCustomSitemapFiles

static deleteCustomSitemapFiles(hostName : String) : void

Deletes all custom sitemap files for the given hostname from the appservers shared file system.

The files are deleted from the directory which is accessible via "Custom Sitemaps" tab under Merchant Tools => SEO => Sitemaps - Custom Sitemaps in Business Manager. To publish that change, the system job "Create Sitemap Schedule" must be executed afterwards.

Parameters:

hostName - The hostName to delete the custom sitemap files for.


deleteCustomSitemapFiles

static deleteCustomSitemapFiles() : void

Deletes all custom sitemap files for all hostnames from the appservers shared file system.

The files are deleted from the directory which is accessible via "Custom Sitemaps" tab under Merchant Tools => SEO => Sitemaps - Custom Sitemaps in Business Manager. To publish that change, the system job "Create Sitemap Schedule" must be executed afterwards.


getCustomSitemapFiles

static getCustomSitemapFiles() : Map

Reads all existing custom sitemap files from files system of the appservers custom sitemap directory into memory and returns them in a Map containing mappings like

  • Hostname 1 => [SitemapFile hostname1_sitemapfile1, SitemapFile hostname1_sitemapfile2]
  • Hostname 2 => [SitemapFile hostname2_sitemapfile1]

Returns:

The created map containing the list of SitemapFiles.