Create page tree with list

import info.magnolia.jcr.util.NodeUtil;

pageTemplate = "light-development-module:pages/article"
rootNode = ""

list = [
	"/eine/erste/seite/",
	"/eine/weiterer/seite1/",
	"/eine/weiterer/seite2/",
]


websitehm = MgnlContext.getInstance().getJCRSession('website')

list.eachWithIndex { urlName, index ->
	node = NodeUtil.createPath(websitehm.getNode("/"), rootNode + urlName, "mgnl:page")
	node.setProperty("mgnl:template", pageTemplate)
}

websitehm.save()
return "page tree created"