WIP: Normal links are rendered...
[maven-thymeleaf-skin] / src / main / resources / META-INF / maven / site.vm
index ca508d4..50bd7ca 100644 (file)
 #end
 
 ## Custom Variablen einlesen
-#set ( $sitePath = $decoration.custom.getChild( 'thymeproxy' ).getChild( 'path' ).getValue() )
-#if ( !$sitePath )
-  #set ( $sitePath = "" )
+#set ( $canonicalPath = $decoration.custom.getChild( 'thymeproxy' ).getChild( 'path' ).getValue() )
+#if ( !$canonicalPath )
+  #set ( $canonicalPath = "" )
 #end
+#set ( $sitePath = $canonicalPath + $project.version + "/" )
 #set ( $siteCrumbs = $decoration.custom.getChild( 'thymeproxy' ).getChild( 'crumbs' ).getValue() )
 
 <!-- name: $pages.get($alignedFileName).name -->
 <!--*/-->
 <html
     xmlns="http://www.w3.org/1999/xhtml"
-    xmlns:layout="http://www.thymeleaf.org"
-    layout:decorator="templates/layout"
-    th:with="
+    th:replace="~{/templates/layout.html :: layout(
       uri='$sitePath$alignedFileName',
-      json='merge:{&quot;pages&quot;:{#set($sep = "")#foreach($page in $pages)$sep&quot;$sitePath$page.uri&quot;:{&quot;name&quot;:&quot;$page.name&quot;,#if(!$page.childs.isEmpty())&quot;childs&quot;:{#set($csep = "")#foreach($child in $page.childs.entrySet())$csep&quot;$sitePath$child.key&quot;:&quot;$child.value&quot;#set($csep = ",")#end},#end&quot;crumbs&quot;:[#set($csep = "")#if($siteCrumbs)$siteCrumbs#set($csep = ",")#end#foreach($crumb in $page.crumbs)$csep{&quot;uri&quot;:&quot;$sitePath$crumb.uri&quot;,&quot;name&quot;:&quot;$crumb.name&quot;}#set($csep = ",")#end]#if($page.title),&quot;title&quot;:&quot;$page.title&quot;#end#if($page.alt),&quot;alt&quot;:&quot;$page.alt&quot;#end#if($page.img),&quot;img&quot;:&quot;$page.img&quot;#end}#set($sep = ",")#end}#if($siteTitle),&quot;site_title&quot;:&quot;$siteTitle&quot;#end#if($siteAlt),&quot;site_alt&quot;:&quot;$siteAlt&quot;#end#if($siteImg),&quot;site_img&quot;:&quot;$siteImg&quot;#end}'
-      "
+      json='MERGE:
+      {
+        &quot;_names&quot;: {
+          #set($sep = "")
+          #foreach($page in $pages)
+            $sep
+            &quot;$sitePath$page.uri&quot;: &quot;$page.name&quot;
+            #set($sep = ",")
+          #end
+        },
+        &quot;_childs&quot;: {
+          #set($sep = "")
+          #foreach($page in $pages)
+            #if(!$page.childs.isEmpty())
+              $sep
+              &quot;$sitePath$page.uri&quot;: [
+                #set($csep = "")
+                #foreach($child in $page.childs.entrySet())
+                  $csep
+                  &quot;$sitePath$child.key&quot;
+                  #set($csep = ",")
+                #end
+              ]
+              #set($sep = ",")
+            #end
+          #end
+        },
+        &quot;_crumbs&quot;: {
+          #set($sep = "")
+          #foreach($page in $pages)
+            $sep
+            &quot;$sitePath$page.uri&quot;: [
+              #set($csep = "")
+              #if($siteCrumbs)
+                $siteCrumbs
+                #set($csep = ",")
+              #end
+              #set($last = "")
+              #foreach($crumb in $page.crumbs)
+                #if($sitePath+$crumb.uri != $last)
+                  $csep
+                  &quot;$sitePath$crumb.uri&quot;
+                  #set($csep = ",")
+                  #set($last = $sitePath+$crumb.uri)
+                #end
+              #end
+            ]
+            #set($sep = ",")
+          #end
+        }
+      }
+      ')}"
     >
   <head>
-    <title>#if($shortTitle and $shortTitle != '')$title#else$project.name &mdash; $pages.get($alignedFileName).name#end</title>
+    <title id="title">#if($shortTitle and $shortTitle != '')$title#else$project.name &mdash; $pages.get($alignedFileName).name#end</title>
     <meta http-equiv="Content-Type" content="text/html; charset=${outputEncoding}" />
-    <link rel="canonical" href="$sitePath$alignedFileName"/>
+    <link id="canonical" rel="canonical" href="$canonicalPath$alignedFileName"/>
   </head>
   <body>
     <h2>Path</h2>
       </ol>
     </p>
     <hr />
-    <article class="main" layout:fragment="maincontent">
+    <article class="maincontent">
       $bodyContent
     </article>
     <hr />