From 7470f501ed0a5aba02d7740fe565b0bbc88b8acb Mon Sep 17 00:00:00 2001 From: Kai Moritz Date: Fri, 8 Jul 2016 18:31:26 +0200 Subject: [PATCH] =?utf8?q?Projekt-Seite=20erstellt:=20Velocity-Template=20?= =?utf8?q?-=20JSON=20=C3=BCber=20th:with=20weitergereicht?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Da die definierten Variablen sonst erst zu spät zur Verfügung stehen, müssen sie per th:with in das Layout-Template hereingereicht und dort mit juplo:variables verarbeitet werden. --- src/site/site.xml | 2 +- src/site/template.vm | 7 +++++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/src/site/site.xml b/src/site/site.xml index ce59948..c89b14c 100644 --- a/src/site/site.xml +++ b/src/site/site.xml @@ -12,7 +12,7 @@ /simple-mapper/ - {"uri":"/projects.html","name":"Projects"},{"uri":"/simple-mapper/index.html","name":"Simple Mapper 4 JSON"} + {"uri":"/projects.html","name":"Projects"},{"uri":"/simple-mapper/index.html","name":"Simple Mapper 4 JSON"} diff --git a/src/site/template.vm b/src/site/template.vm index 8295340..f7e6c8b 100644 --- a/src/site/template.vm +++ b/src/site/template.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
-- 2.20.1