Fixed possible NullPointerException during link-calculation
[maven-thymeleaf-skin] / src / main / resources / META-INF / maven / site.vm
index a6055e5..ca508d4 100644 (file)
@@ -7,7 +7,11 @@
 #set ( $stack = $project.getClass().forName('java.util.LinkedList').newInstance() )
 #macro ( buildPages $menu )
 
-  #set ( $currentItemHref = $PathTool.calculateLink( $item.href, $relativePath ) )
+  #if ( $menu.href )
+    #set ( $currentItemHref = $PathTool.calculateLink( $menu.href, $relativePath ) )
+  #else
+    #set ( $currentItemHref = '' )
+  #end
   #set ( $currentItemHref = $currentItemHref.replaceAll( '\\', '/' ) )
 
   #if ($currentItemHref)
 #end
 #set ( $siteCrumbs = $decoration.custom.getChild( 'thymeproxy' ).getChild( 'crumbs' ).getValue() )
 
+<!-- name: $pages.get($alignedFileName).name -->
 <!-- title: $title -->
 <!-- short title: $shortTitle -->
 <!-- current page: $alignedFileName -->
       "
     >
   <head>
-    <title>juplo - $title</title>
+    <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"/>
   </head>
     </p>
     <hr />
     <article class="main" layout:fragment="maincontent">
-      <header><h1>$shortTitle</h1></header>
       $bodyContent
     </article>
     <hr />