ACS Commons provides OSGI Sitemap config service to generate sitemap xml file which is used by web crawler to optimize web search results. The provided sitemap servlet takes input from externalizer configuration which acts as domain to the list of content pages. This hosted configuration would have a root domain to the list of locales available for an application. This remains constant for applications having more than one domain and the purpose of multiples domains is not achieved. This can be achieved via switching externalizer domain config to page properties values. Example shown below:
From externalizer setting:
Code from:
String loc = externalizer.externalLink(resolver, externalizerDomain,
String.format("%s.html", page.getPath()));
writeElement(stream, "loc", loc);
New Page properties Config value to be taken from each country landing page:
Code to:
Resource resource = request.getResource();
InheritanceValueMap iProperties = new HierarchyNodeInheritanceValueMap(resource);
String siteMapHierarchy = iProperties.getInherited("sitemapvalue",String.class);
String resolverMap = resolver.map(page.getPath());
if(siteMapHierarchy != null){
String locPath = siteMapHierarchy.concat(String.format("%s.html", resolverMap));
writeElement(stream, "loc", locPath);
}