From: Kai Moritz Date: Sun, 28 Feb 2021 16:23:17 +0000 (+0100) Subject: Prevented the override of the entry-page with the changed title "About" X-Git-Tag: maven-thymeleaf-skin-1.1.0~8 X-Git-Url: http://juplo.de/gitweb/?a=commitdiff_plain;h=0c6b512af3d695df17a7b80e5c55a2873f6c09f3;p=maven-thymeleaf-skin Prevented the override of the entry-page with the changed title "About" * The maven-site-plugin includes an entry for the index.html in the root of the documentation in the subdirectory "Project Info". * This entry must be droped, because it overrides the correct definition for that page with a false title ("About") and path (the page is added as a child of the submenu "Project Info"). --- diff --git a/src/main/resources/META-INF/maven/site.vm b/src/main/resources/META-INF/maven/site.vm index 1aab317..1e336ed 100644 --- a/src/main/resources/META-INF/maven/site.vm +++ b/src/main/resources/META-INF/maven/site.vm @@ -14,69 +14,80 @@ #end #set ( $currentItemHref = $currentItemHref.replaceAll( '\\', '/' ) ) - #if ($currentItemHref) - #set( $sinkhole = $stack.peek().childs.put($currentItemHref, $menu.name) ) + #set ( $seen = false ) + #foreach ( $entry in $stack ) + #if ( $entry.uri == $currentItemHref ) + #set ( $seen = true ) + #end #end - #set ( $page = $project.getClass().forName('java.util.LinkedHashMap').newInstance() ) - #set ( $sinkhole = $page.put("name", $menu.name) ) - #set ( $sinkhole = $page.put("uri", $currentItemHref) ) - #set ( $sinkhole = $page.put("childs", $project.getClass().forName('java.util.LinkedHashMap').newInstance()) ) - #set ( $sinkhole = $stack.push( $page ) ) + #if ( !$seen ) + #if ($currentItemHref) + #set( $sinkhole = $stack.peek().childs.put($currentItemHref, $menu.name) ) + #end - #if ($menu.title) - #set( $sinkhole = $page.put("title", $menu.title) ) - #end - #if ($menu.alt) - #set( $sinkhole = $page.put("alt", $menu.alt) ) - #end - #if ($menu.img) - #set( $sinkhole = $page.put("img", $menu.img) ) - #end + #set ( $page = $project.getClass().forName('java.util.LinkedHashMap').newInstance() ) + #set ( $sinkhole = $page.put("name", $menu.name) ) + #set ( $sinkhole = $page.put("uri", $currentItemHref) ) + #set ( $sinkhole = $page.put("childs", $project.getClass().forName('java.util.LinkedHashMap').newInstance()) ) + #set ( $sinkhole = $stack.push( $page ) ) - #foreach ( $item in $menu.items ) - #buildPages ( $item ) - #end + #if ($menu.title) + #set( $sinkhole = $page.put("title", $menu.title) ) + #end + #if ($menu.alt) + #set( $sinkhole = $page.put("alt", $menu.alt) ) + #end + #if ($menu.img) + #set( $sinkhole = $page.put("img", $menu.img) ) + #end - #set ( $page = $stack.pop() ) - #if ( $page.uri != "" ) - - #set ( $crumbs = $project.getClass().forName('java.util.LinkedList').newInstance() ) - #set ( $crumb = $project.getClass().forName('java.util.LinkedHashMap').newInstance() ) - #set ( $sinkhole = $crumb.put("uri", $page.uri) ) - #set ( $sinkhole = $crumb.put("name", $page.name) ) - #set ( $sinkhole = $crumbs.push($crumb) ) - #foreach ( $entry in $stack ) - #if ( $entry.uri != "" ) - #set ( $crumb = $project.getClass().forName('java.util.LinkedHashMap').newInstance() ) - #set ( $sinkhole = $crumb.put("uri", $entry.uri) ) - #set ( $sinkhole = $crumb.put("name", $entry.name) ) - #set ( $sinkhole = $crumbs.push($crumb) ) - #end + #foreach ( $item in $menu.items ) + #buildPages ( $item ) #end - #set ( $sinkhole = $page.put("crumbs", $crumbs) ) - #if ( $pages.containsKey($page.uri) ) - #set ( $childs = $pages.get($page.uri).childs ) - #set ( $sinkhole = $page.put("childs", $childs) ) + #set ( $page = $stack.pop() ) + #if ( $page.uri != "" ) + + #set ( $crumbs = $project.getClass().forName('java.util.LinkedList').newInstance() ) + #set ( $crumb = $project.getClass().forName('java.util.LinkedHashMap').newInstance() ) + #set ( $sinkhole = $crumb.put("uri", $page.uri) ) + #set ( $sinkhole = $crumb.put("name", $page.name) ) + #set ( $sinkhole = $crumbs.push($crumb) ) + #foreach ( $entry in $stack ) + #if ( $entry.uri != "" ) + #set ( $crumb = $project.getClass().forName('java.util.LinkedHashMap').newInstance() ) + #set ( $sinkhole = $crumb.put("uri", $entry.uri) ) + #set ( $sinkhole = $crumb.put("name", $entry.name) ) + #set ( $sinkhole = $crumbs.push($crumb) ) + #end + #end + #set ( $sinkhole = $page.put("crumbs", $crumbs) ) - - #else + #if ( $pages.containsKey($page.uri) ) + #set ( $childs = $pages.get($page.uri).childs ) + #set ( $sinkhole = $page.put("childs", $childs) ) - - #end + + #else - #set ( $sinkhole = $pages.put($page.uri, $page) ) + + #end - #else + #set ( $sinkhole = $pages.put($page.uri, $page) ) - #else(no name)--> - #set( $siteTitle = $menu.title ) - #set( $siteAlt = $menu.alt ) - #set( $siteImg = $menu.img ) - #set( $sinkhole = $pages.get("index.html").put("childs", $page.childs) ) - #end + #else + + #else(no name)--> + #set( $siteTitle = $menu.title ) + #set( $siteAlt = $menu.alt ) + #set( $siteImg = $menu.img ) + #set( $sinkhole = $pages.get("index.html").put("childs", $page.childs) ) + #end + #end + #else + #end #end