Sitemap
You can generate a site map using the out of box generators by hitting the /sitemap*.xml
or /sitemap*.gz
urls. This will trigger the SiteMapController
which will then funnel into the SiteMapServiceImpl.getSiteMapFile(String fileName)
method which will loop through each SiteMap Generator's configuration entries.
Note: For large catalogs, do not start more than one instance since they may take a long time to complete and it could potentially overload the server if this is triggered lots of times back to back.
We have the following out-of-box generators:
Category SiteMap Generator
: Builds the url entries for categoriesProduct SiteMap Generator
: Builds the url entries for productsPage SiteMap Generator
: Builds the url entries for pagesSite SiteMap Generator
: Defines custom url entries
These have been setup with a default configuration used for the Demo Site. Look at common/src/main/resources/config/bc/sql/demo/load_sitemap_data.sql
to see how the demo data is setup to generate a site map. see it in Github
When configuring a Sitemap Generator you will need to add an entry in BLC_MODULE_CONFIGURATION
and BLC_SITE_MAP_CFG
and then tie the specific generator's configurations to this module config.
INSERT INTO BLC_MODULE_CONFIGURATION (MODULE_CONFIG_ID,CONFIG_TYPE,IS_DEFAULT,MODULE_NAME,MODULE_PRIORITY,ACTIVE_START_DATE) VALUES (-1,'SITE_MAP',TRUE,'SITE_MAP',100,CURRENT_TIMESTAMP);
INSERT INTO BLC_SITE_MAP_CFG (MODULE_CONFIG_ID) VALUES (-1);
You will then need to add an entry in BLC_SITE_MAP_GEN_CFG
that will define how each generator will run. Here is an excerpt where we setup config a custom
, product
, page
and a category
generator.
INSERT INTO BLC_SITE_MAP_GEN_CFG (GEN_CONFIG_ID,MODULE_CONFIG_ID,DISABLED,CHANGE_FREQ,GENERATOR_TYPE,PRIORITY) VALUES (-1,-1,FALSE,'HOURLY','CUSTOM','0.5');
INSERT INTO BLC_CUST_SITE_MAP_GEN_CFG (GEN_CONFIG_ID) VALUES (-1);
INSERT INTO BLC_SITE_MAP_GEN_CFG (GEN_CONFIG_ID,MODULE_CONFIG_ID,DISABLED,CHANGE_FREQ,GENERATOR_TYPE,PRIORITY) VALUES (-2,-1,FALSE,'HOURLY','PRODUCT','0.5');
INSERT INTO BLC_SITE_MAP_GEN_CFG (GEN_CONFIG_ID,MODULE_CONFIG_ID,DISABLED,CHANGE_FREQ,GENERATOR_TYPE,PRIORITY) VALUES (-3,-1,FALSE,'HOURLY','PAGE','0.5');
INSERT INTO BLC_SITE_MAP_GEN_CFG (GEN_CONFIG_ID,MODULE_CONFIG_ID,DISABLED,CHANGE_FREQ,GENERATOR_TYPE,PRIORITY) VALUES (-4,-1,FALSE,'HOURLY','CATEGORY','0.5');
INSERT INTO BLC_CAT_SITE_MAP_GEN_CFG (GEN_CONFIG_ID,ROOT_CATEGORY_ID,STARTING_DEPTH,ENDING_DEPTH) VALUES (-4,2001,0,0);
Note that when configuring a Category Sitemap Generator specifically you will need to add an entry in BLC_CAT_SITE_MAP_GEN_CFG
for each category tree you want generated. You will be able to set the top level category and how deep you want it to go. This will give control of exactly which categories to include in the sitemap if such granular control is needed. In the demo data we are adding a configuration for each category separately.
For custom
, page
and product
you will only need one entry (the default ones can be used in the demo data can be used).
There are a series of properties
used by the site service that allow for some tuning on how these will get generated:
sitemap.gzip.files=false
sitemap.cache.seconds=0
sitemap.createIfTimeoutExpired=true
sitemap.createIfNotFound=true