ACS Commons Sitemap Servlet extension to support Multiple Languages Domain


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

Comments

  1. Great concept.. Thanks for share...

    ReplyDelete
  2. Hi Neeraj,

    Could you please send me the github url for the above code.

    ReplyDelete

Post a Comment

Popular posts from this blog

AEM 6.3 | Apache Sling Content Disposition Filter | Hosting Static HTML in JCR

Image Component Customization - Image Size Restriction - Drag/Drop - Touch UI

Access OSGI ser­vice from Sightly WCMUsePojo | AEM 6.3