sitemap End user Legacy Jahia 7.3

Generate a sitemap


My website does not have a sitemap and I need to generate it: how can it be done?


To generate a sitemapn the module Jahia sitemap is the one to use. Unfortunately as it was not added when the website was created, you have to follow these following steps:

  • Install the module sitemap and associate it to your website
  • Go the JCR Console (DX_URL/modules/tools/jcrConsole.jsp) and execute the following script
    def siteName = "SITE_NAME";
    def ni = session.getWorkspace().getQueryManager().createQuery("select * from [jnt:page] where ['jcr:mixinTypes'] <> 'jmix:sitemap' and ISDESCENDANTNODE('/sites/" + siteName + "')", Query.JCR_SQL2).execute().getNodes(); 
    while (ni.hasNext()) {
     def n = ni.nextNode();
     n.addMixin("jmix:sitemap");"Added mixin for : " + n.getPath()); 
    • This script will add the mixin jmix:sitemap which is being used to generate the sitemap
  • From the edit mode, publish all of your website in order to apply the previous modifications to the live workspace
  • Open the URL WEBSITE_URL/sitemap.xml