From: Kai Moritz Date: Fri, 8 Jul 2016 16:31:26 +0000 (+0200) Subject: JSON is handed to the thymeleaf-layout-template via th:with X-Git-Tag: maven-thymeleaf-skin-1.0.0~11 X-Git-Url: http://juplo.de/gitweb/?a=commitdiff_plain;h=23d828ee5b1f217f984cf27e750b5a4d26472b9a;p=maven-thymeleaf-skin JSON is handed to the thymeleaf-layout-template via th:with The page-data is handed to the template via th:with als variable "json". --- diff --git a/src/main/resources/META-INF/maven/site.vm b/src/main/resources/META-INF/maven/site.vm index 8295340..f7e6c8b 100644 --- a/src/main/resources/META-INF/maven/site.vm +++ b/src/main/resources/META-INF/maven/site.vm @@ -115,7 +115,10 @@ xmlns="http://www.w3.org/1999/xhtml" xmlns:layout="http://www.thymeleaf.org" layout:decorator="templates/layout" - th:with="uri='$sitePath$alignedFileName'" + th:with=" + uri='$sitePath$alignedFileName', + json='merge:{"pages":{#set($sep = "")#foreach($page in $pages)$sep"$sitePath$page.uri":{"name":"$page.name",#if(!$page.childs.isEmpty())"childs":{#set($csep = "")#foreach($child in $page.childs.entrySet())$csep"$sitePath$child.key":"$child.value"#set($csep = ",")#end},#end"crumbs":[#set($csep = "")#if($siteCrumbs)$siteCrumbs#set($csep = ",")#end#foreach($crumb in $page.crumbs)$csep{"uri":"$sitePath$crumb.uri","name":"$crumb.name"}#set($csep = ",")#end]#if($page.title),"title":"$page.title"#end#if($page.alt),"alt":"$page.alt"#end#if($page.img),"img":"$page.img"#end}#set($sep = ",")#end}#if($siteTitle),"site_title":"$siteTitle"#end#if($siteAlt),"site_alt":"$siteAlt"#end#if($siteImg),"site_img":"$siteImg"#end}' + " > juplo - $title @@ -130,7 +133,7 @@


-
+

$shortTitle

$bodyContent
diff --git a/src/site/site.xml b/src/site/site.xml index 4ac76eb..015e0b3 100644 --- a/src/site/site.xml +++ b/src/site/site.xml @@ -24,7 +24,7 @@ /maven-thymeleaf-skin/ - {"uri":"/projects.html","name":"Projects"},{"uri":"/maven-thymeleaf-skin/index.html","name":"Apache-Maven Thymeleaf-Skin"} + {"uri":"/projects.html","name":"Projects"},{"uri":"/maven-thymeleaf-skin/index.html","name":"Apache-Maven Thymeleaf-Skin"}