Expand my Community achievements bar.

ACS Commons Sitemap Servlet extension to support Multiple Languages Domain

Avatar

Level 2

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);

        }

1 Reply

Avatar

Level 1

Our site is having multiple domain i.e. around 40 sites which have separate domain names. Can somebody help us here in finding out how can we extend ACS common sitemap generator Servlet to generate sitemap.xml for 40 different domains without creating separate configuration for each domain?