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