Prevented the override of the entry-page with the changed title "About"
[maven-thymeleaf-skin] / src / main / resources / META-INF / maven / site.vm
1 <!DOCTYPE html>
2 <!--/*-->
3 <!-- Generated by Apache Maven Doxia Site Renderer#if( $doxiaSiteRendererVersion ) $doxiaSiteRendererVersion#end at $dateFormat.format( $currentDate ) -->
4
5
6 #set ( $pages = $project.getClass().forName('java.util.LinkedHashMap').newInstance() )
7 #set ( $stack = $project.getClass().forName('java.util.LinkedList').newInstance() )
8 #macro ( buildPages $menu )
9
10   #if ( $menu.href )
11     #set ( $currentItemHref = $PathTool.calculateLink( $menu.href, $relativePath ) )
12   #else
13     #set ( $currentItemHref = '' )
14   #end
15   #set ( $currentItemHref = $currentItemHref.replaceAll( '\\', '/' ) )
16
17   #set ( $seen = false )
18   #foreach ( $entry in $stack )
19     #if ( $entry.uri == $currentItemHref )
20       #set ( $seen = true )
21     #end
22   #end
23
24   #if ( !$seen )
25     #if ($currentItemHref)
26       #set( $sinkhole = $stack.peek().childs.put($currentItemHref, $menu.name) )
27     #end
28
29     #set ( $page = $project.getClass().forName('java.util.LinkedHashMap').newInstance() )
30     #set ( $sinkhole = $page.put("name", $menu.name) )
31     #set ( $sinkhole = $page.put("uri", $currentItemHref) )
32     #set ( $sinkhole = $page.put("childs", $project.getClass().forName('java.util.LinkedHashMap').newInstance()) )
33     #set ( $sinkhole = $stack.push( $page ) )
34
35     #if ($menu.title)
36       #set( $sinkhole = $page.put("title", $menu.title) )
37     #end
38     #if ($menu.alt)
39       #set( $sinkhole = $page.put("alt", $menu.alt) )
40     #end
41     #if ($menu.img)
42       #set( $sinkhole = $page.put("img", $menu.img) )
43     #end
44
45     #foreach ( $item in $menu.items )
46       #buildPages ( $item )
47     #end
48
49     #set ( $page = $stack.pop() )
50     #if ( $page.uri != "" )
51
52       #set ( $crumbs = $project.getClass().forName('java.util.LinkedList').newInstance() )
53       #set ( $crumb = $project.getClass().forName('java.util.LinkedHashMap').newInstance() )
54       #set ( $sinkhole = $crumb.put("uri", $page.uri) )
55       #set ( $sinkhole = $crumb.put("name", $page.name) )
56       #set ( $sinkhole = $crumbs.push($crumb) )
57       #foreach ( $entry in $stack )
58         #if ( $entry.uri != "" )
59           #set ( $crumb = $project.getClass().forName('java.util.LinkedHashMap').newInstance() )
60           #set ( $sinkhole = $crumb.put("uri", $entry.uri) )
61           #set ( $sinkhole = $crumb.put("name", $entry.name) )
62           #set ( $sinkhole = $crumbs.push($crumb) )
63         #end
64       #end
65       #set ( $sinkhole = $page.put("crumbs", $crumbs) )
66
67       #if ( $pages.containsKey($page.uri) )
68         #set ( $childs = $pages.get($page.uri).childs )
69         #set ( $sinkhole = $page.put("childs", $childs) )
70
71         <!-- OVERWRITING PAGE - uri: $page.uri / name: $page.name -->
72       #else
73
74         <!-- NEW PAGE - - - - - uri: $page.uri / name: $page.name -->
75       #end
76
77       #set ( $sinkhole = $pages.put($page.uri, $page) )
78
79     #else
80
81       <!-- DONE WITH MENUE -  - #if($page.name)$page.name-->#else(no name)-->
82         #set( $siteTitle = $menu.title )
83         #set( $siteAlt = $menu.alt )
84         #set( $siteImg = $menu.img )
85         #set( $sinkhole = $pages.get("index.html").put("childs", $page.childs) )
86       #end
87
88     #end
89   #else
90     <!-- Skipping already seen entry: uri=$currentItemHref, name=$menu.name -->
91   #end
92 #end
93
94
95 ## Seiten einlesen
96 #set ( $page = $project.getClass().forName('java.util.LinkedHashMap').newInstance() )
97 #set ( $sinkhole = $page.put("uri", "index.html") )
98 #set ( $sinkhole = $page.put("name", "$project.name") )
99 #set ( $crumbs = $project.getClass().forName('java.util.LinkedList').newInstance() )
100 #set ( $crumb = $project.getClass().forName('java.util.LinkedHashMap').newInstance() )
101 #set ( $sinkhole = $crumb.put("uri", $page.uri) )
102 #set ( $sinkhole = $crumb.put("name", $page.name) )
103 #set ( $sinkhole = $crumbs.push( $crumb ) )
104 #set ( $sinkhole = $page.put("crumbs", $crumbs ) )
105 #set ( $sinkhole = $pages.put($page.uri, $page) )
106 #set ( $sinkhole = $stack.push($page) )
107 #foreach ( $menu in $decoration.body.menus )
108   ## Nur benannte Menüs werden berücksichtigt
109   #if ($menu.name)
110     #buildPages ( $menu )
111   #end
112 #end
113 #foreach ( $menu in $decoration.body.menus )
114   ## Nur unbenannte Menüs werden berücksichtigt
115   #if (!($menu.name))
116     #buildPages ( $menu )
117   #end
118 #end
119
120 ## Custom Variablen einlesen
121 #set ( $canonicalPath = $decoration.custom.getChild( 'thymeproxy' ).getChild( 'path' ).getValue() )
122 #if ( !$canonicalPath )
123   #set ( $canonicalPath = "" )
124 #end
125 #set ( $sitePath = $canonicalPath + $project.version + "/" )
126 #set ( $siteCrumbs = $decoration.custom.getChild( 'thymeproxy' ).getChild( 'crumbs' ).getValue() )
127
128 <!-- name: $pages.get($alignedFileName).name -->
129 <!-- title: $title -->
130 <!-- short title: $shortTitle -->
131 <!-- current page: $alignedFileName -->
132 <!-- path: $sitePath -->
133 <!-- crumbs: $siteCrumbs -->
134 <!-- pages: $pages -->
135
136
137 <!--*/-->
138 <html
139     xmlns="http://www.w3.org/1999/xhtml"
140     th:replace="~{/templates/layout.html :: layout(
141       uri='$sitePath$alignedFileName',
142       title=~{:: title},
143       maincontent=~{:: .maincontent},
144       json='MERGE:
145       {
146         &quot;_titles&quot;: {
147           #set($sep = "")
148           #foreach($page in $pages)
149             $sep
150             &quot;$sitePath$page.uri&quot;: &quot;$page.name&quot;
151             #set($sep = ",")
152           #end
153         },
154         &quot;_childs&quot;: {
155           #set($sep = "")
156           #foreach($page in $pages)
157             #if(!$page.childs.isEmpty())
158               $sep
159               &quot;$sitePath$page.uri&quot;: [
160                 #set($csep = "")
161                 #foreach($child in $page.childs.entrySet())
162                   $csep
163                   &quot;$sitePath$child.key&quot;
164                   #set($csep = ",")
165                 #end
166               ]
167               #set($sep = ",")
168             #end
169           #end
170         },
171         &quot;_crumbs&quot;: {
172           #set($sep = "")
173           #foreach($page in $pages)
174             $sep
175             &quot;$sitePath$page.uri&quot;: [
176               #set($csep = "")
177               #if($siteCrumbs)
178                 $siteCrumbs
179                 #set($csep = ",")
180               #end
181               #set($last = "")
182               #foreach($crumb in $page.crumbs)
183                 #if($sitePath+$crumb.uri != $last)
184                   $csep
185                   &quot;$sitePath$crumb.uri&quot;
186                   #set($csep = ",")
187                   #set($last = $sitePath+$crumb.uri)
188                 #end
189               #end
190             ]
191             #set($sep = ",")
192           #end
193         }
194       }
195       ')}"
196     >
197   <head>
198     <title id="title">#if($shortTitle and $shortTitle != '')$title#else$project.name &mdash; $pages.get($alignedFileName).name#end</title>
199     <meta http-equiv="Content-Type" content="text/html; charset=${outputEncoding}" />
200     <link id="canonical" rel="canonical" href="$canonicalPath$alignedFileName"/>
201   </head>
202   <body>
203     <h2>Path</h2>
204     <p>
205       <ol>
206         #foreach($crumb in $pages.get($alignedFileName).crumbs)<li><a href="$crumb.uri">$crumb.name</a></li>#end
207       </ol>
208     </p>
209     <hr />
210     <article class="maincontent">
211       $bodyContent
212     </article>
213     <hr />
214     <h2>Pages</h2>
215     <p>
216       <ul>
217         #foreach($page in $pages)<li><a href="$page.uri">$page.name</a></li>#end
218       </ul>
219     </p>
220   </body>
221 </html>