Hi Team,
Can we remove sitemap-index as per the requirement from apache sitemapservlet directly or do we need to add the configuration of apache servlet in out code and remove sitemap-index selector?
Solved! Go to Solution.
Views
Replies
Total Likes
okay, got it. You can try making a custom servlet that extends the SitemapServlet lets say "mySitemapServlet". Override the methods there and try to generate different sitemaps based on your project names. Take the project name from its config.
Hi, If you have permissions to access the prod's CRXDE config manager then you can manually update the configuration there. To update the configuration, go to the URL: http://[host]:[port]/system/console/configMgr and search for sitemapservlet there and update the configs as per requirements.
If you don't have access to the prod's CRXDE you can update the config via your code base so next time you deploy your code the configs are updated automatically. To achieve this, go to osgiconfig folder, you will see folders inside these like config, config.prod, config.qa etc. If you only have config folder, you can place the below file in that only.
Note: In this case the new configuration will reflect in all the environments. By default, the configurations are picked from it. For a particular environment, place the below file in the respective config only.
Make a file named: org.apache.sling.sitemap.impl.SitemapServlet.cfg.json and place it inside the required config folder.
The content of the file shall look like this:
{
"sling.servlet.extensions":[
"xml"
],
"sling.servlet.resourceTypes":[
"wcm/foundation/components/basicpage/v1/basicpage"
],
"sling.servlet.selectors":[
"sitemap",
"sitemap-index"
]
}
play with the above file on local to update the values as per requirements.
HI Thank you,
But org.apache.sling.sitemap.impl.SitemapServlet this is not a factory configuration if any other project has this configuration will it get overriden by that?
Hi @Keerthi0555, every project has its own set of configs. Doing the above procedure will be valid for the single project you are working on. For every different project you have to follow the above steps in order to manipulate the configs. Please elaborate what you are trying to say regarding factory configs.
Hi Kapil,
I tried in my local with two different projects having same org.apache.sling.sitemap.impl.SitemapServlet configuration so the first deployed project's configuration is getting overridden by the last deployed one.
Factory configuration - multiple configurations for single configuraiton.org.apache.sling.sitemap.impl.SitemapServlet is not factory configuration.
okay, got it. You can try making a custom servlet that extends the SitemapServlet lets say "mySitemapServlet". Override the methods there and try to generate different sitemaps based on your project names. Take the project name from its config.