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:
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"); log.info("Added mixin for : " + n.getPath()); } session.save();