From: Kai Moritz Date: Sun, 28 Feb 2021 19:44:44 +0000 (+0100) Subject: The JSON is rendered in the page and picked up there by thymeleaf X-Git-Tag: maven-thymeleaf-skin-1.1.0~5 X-Git-Url: http://juplo.de/gitweb/?a=commitdiff_plain;h=73b5e8c984163e4fe64c437f9bd5736907e5b80c;p=maven-thymeleaf-skin The JSON is rendered in the page and picked up there by thymeleaf --- diff --git a/src/main/resources/META-INF/maven/site.vm b/src/main/resources/META-INF/maven/site.vm index 1e336ed..b81690c 100644 --- a/src/main/resources/META-INF/maven/site.vm +++ b/src/main/resources/META-INF/maven/site.vm @@ -141,59 +141,7 @@ uri='$sitePath$alignedFileName', title=~{:: title}, maincontent=~{:: .maincontent}, - json='MERGE: - { - "_titles": { - #set($sep = "") - #foreach($page in $pages) - $sep - "$sitePath$page.uri": "$page.name" - #set($sep = ",") - #end - }, - "_childs": { - #set($sep = "") - #foreach($page in $pages) - #if(!$page.childs.isEmpty()) - $sep - "$sitePath$page.uri": [ - #set($csep = "") - #foreach($child in $page.childs.entrySet()) - $csep - "$sitePath$child.key" - #set($csep = ",") - #end - ] - #set($sep = ",") - #end - #end - }, - "_crumbs": { - #set($sep = "") - #foreach($page in $pages) - $sep - "$sitePath$page.uri": [ - #set($csep = "") - #if($siteCrumbs) - $siteCrumbs - #set($csep = ",") - #end - #set($last = "") - #foreach($crumb in $page.crumbs) - #if($sitePath+$crumb.uri != $last) - $csep - "$sitePath$crumb.uri" - #set($csep = ",") - #set($last = $sitePath+$crumb.uri) - #end - #end - ] - #set($sep = ",") - #end - } - } - ')}" - > + json='MERGE:' + ~{:: pre[class='json']/text()})}" > #if($shortTitle and $shortTitle != '')$title#else$project.name — $pages.get($alignedFileName).name#end @@ -211,7 +159,33 @@ $bodyContent
-

Pages

+

Page Structure as JSON

+
+{
+  "_titles": {#set($sep = "")#foreach($page in $pages)$sep
+    "$sitePath$page.uri": "$page.name"#set($sep = ",")
+#end
+
+  },
+  "_childs": {#set($sep = "")#foreach($page in $pages)#if(!$page.childs.isEmpty())$sep
+    "$sitePath$page.uri": [#set($csep = "")#foreach($child in $page.childs.entrySet())$csep
+      "$sitePath$child.key"#set($csep = ",")#end
+
+    ]#set($sep = ",")#end#end
+
+  },
+  "_crumbs": {#set($sep = "")#foreach($page in $pages)$sep
+    "$sitePath$page.uri": [
+#set($csep = "")#if($siteCrumbs)
+      $siteCrumbs#set($csep = ",")#end#set($last = "")#foreach($crumb in $page.crumbs)#if($sitePath+$crumb.uri != $last)$csep
+      "$sitePath$crumb.uri"#set($csep = ",")#set($last = $sitePath+$crumb.uri)#end#end
+
+    ]#set($sep = ",")#end
+
+  }
+}
+    
+

All Pages