]> juplo.de Git - maven-thymeleaf-skin/commitdiff
Refactored (and renamed) the Skin for the Hugo site-generator
authorKai Moritz <kai@juplo.de>
Fri, 31 Oct 2025 11:51:31 +0000 (12:51 +0100)
committerKai Moritz <kai@juplo.de>
Mon, 2 Feb 2026 14:46:48 +0000 (15:46 +0100)
pom.xml
src/main/resources/META-INF/maven/site.vm

diff --git a/pom.xml b/pom.xml
index 19702fb65adefaefa423eb2bd5dcbf7ed3fda7c4..b2cd6ab33e5fbf42d2aa6ca2e44dc4acff670650 100644 (file)
--- a/pom.xml
+++ b/pom.xml
@@ -9,17 +9,17 @@
   </parent>
 
   <groupId>de.juplo.maven</groupId>
-  <artifactId>maven-thymeleaf-skin</artifactId>
-  <version>1.1.2</version>
+  <artifactId>maven-hugo-skin</artifactId>
+  <version>1.0.0-SNAPSHOT</version>
 
-  <name>Thymeleaf-Skin</name>
-  <description>A maven skin, that renders the site as thymeleaf-templates.</description>
-  <url>http://juplo.de/maven-thymeleaf-skin/index.html</url>
+  <name>Hugo-Skin</name>
+  <description>A maven skin, that renders the site as content for Hugo.</description>
+  <url>http://juplo.de/maven-hugo-skin/index.html</url>
 
   <scm>
-    <connection>scm:git:http://juplo.de/git/maven-thymeleaf-skin</connection>
-    <developerConnection>scm:git:ssh://juplo.de:/var/lib/git/juplo/maven-thymeleaf-skin</developerConnection>
-    <url>http://juplo.de/gitweb/?p=maven-thymeleaf-skin;a=summary</url>
+    <connection>scm:git:http://juplo.de/git/maven-hugo-skin</connection>
+    <developerConnection>scm:git:ssh://juplo.de:/var/lib/git/juplo/maven-hugo-skin</developerConnection>
+    <url>http://juplo.de/gitweb/?p=maven-hugo-skin;a=summary</url>
   </scm>
 
   <developers>
index 366dcfd74fc79e446935dac58d86d40dcd73a0d3..1cbbee982fc1da4c9338568f94b9d577946b91ad 100644 (file)
-<!DOCTYPE html>
-<!--/*-->
-<!-- Generated by Apache Maven Doxia Site Renderer#if( $doxiaSiteRendererVersion ) $doxiaSiteRendererVersion#end at $dateFormat.format( $currentDate ) -->
-
-
 #set ( $pages = $project.getClass().forName('java.util.LinkedHashMap').newInstance() )
 #set ( $stack = $project.getClass().forName('java.util.LinkedList').newInstance() )
-#macro ( buildPages $menu )
-
-  #if ( $menu.href )
-    #set ( $currentItemHref = $PathTool.calculateLink( $menu.href, $relativePath ) )
+#macro ( buildPages $item )
+  <!-- VISITING PAGE - href: $item.href / name: $item.name -->
+  #if ( $item.href )
+    #set ( $currentItemHref = $PathTool.calculateLink( $item.href, $relativePath ) )
   #else
     #set ( $currentItemHref = '' )
   #end
   #set ( $currentItemHref = $currentItemHref.replaceAll( '\\', '/' ) )
-
-  #set ( $seen = false )
-  #foreach ( $entry in $stack )
-    #if ( $entry.uri == $currentItemHref )
-      #set ( $seen = true )
-    #end
-  #end
-
-  #if ( !$seen )
-    #if ($currentItemHref)
-      #set( $sinkhole = $stack.peek().childs.put($currentItemHref, $menu.name) )
-    #end
-
+  #if ( $currentItemHref and !$pages.containsKey( $currentItemHref) )
+    #set ( $sinkhole = $stack.peek().childs.add($currentItemHref) )
     #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 = $page.put("name", $item.name) )
+    #set ( $sinkhole = $page.put("href", $currentItemHref) )
+    #set ( $sinkhole = $page.put("childs", $project.getClass().forName('java.util.LinkedList').newInstance()) )
+    #set ( $sinkhole = $pages.put($page.href, $page) )
     #set ( $sinkhole = $stack.push( $page ) )
-
-    #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
-
-    #foreach ( $item in $menu.items )
-      #buildPages ( $item )
-    #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
+    #if ($item.image)
+      #set ( $image = $project.getClass().forName('java.util.LinkedHashMap').newInstance() )
+      #set ( $sinkhole = $page.put("image", $image) )
+      #if ($item.image.src)
+        #set ( $sinkhole = $image.put("src", $item.image.src) )
       #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) )
-
-        <!-- OVERWRITING PAGE - uri: $page.uri / name: $page.name -->
-      #else
-
-        <!-- NEW PAGE - - - - - uri: $page.uri / name: $page.name -->
+      #if ($item.image.position)
+        #set ( $sinkhole = $image.put("position", $item.image.position) )
       #end
-
-      #set ( $sinkhole = $pages.put($page.uri, $page) )
-
-    #else
-
-      <!-- DONE WITH MENUE -  - #if($page.name)$page.name-->#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) )
+      #if ($item.image.alt)
+        #set ( $sinkhole = $image.put("alt", $item.image.alt) )
+      #end
+      #if ($item.image.width)
+        #set ( $sinkhole = $image.put("width", $item.image.width) )
+      #end
+      #if ($item.image.height)
+        #set ( $sinkhole = $image.put("height", $item.image.height) )
+      #end
+      #if ($item.image.style)
+        #set ( $sinkhole = $image.put("style", $item.image.style) )
       #end
-
     #end
+    #foreach ( $entry in $item.items )
+      #buildPages ( $entry )
+    #end
+    #set ( $page = $stack.pop() )
+    #set ( $crumbs = $project.getClass().forName('java.util.LinkedList').newInstance() )
+    #foreach ( $entry in $stack )
+      #set ( $sinkhole = $crumbs.push($entry.href) )
+    #end
+    #set ( $sinkhole = $page.put("crumbs", $crumbs) )
   #else
-    <!-- Skipping already seen entry: uri=$currentItemHref, name=$menu.name -->
+    <!-- SKIPPING already seen PAGE: href=$currentItemHref, name=$item.name -->
   #end
 #end
+---
+title: $!{shortTitle}
+lastmod: ${date.get("yyyy-MM-dd'T'HH:mm:ssZ")}
+params:
+  generator: Apache Maven Doxia Site Renderer $!{doxiaSiteRendererVersion}
+  project:
+    groupId: $!{project.groupId}
+    artifactId: $!{project.artifactId}
+    version: $!{project.version}
+    name: $!{project.name}
+    description: $!{project.description}
+  site:
+    name: $!{site.name}
+    url: $!{site.url}
+outputs:
+  - html
+url: $!{site.custom.getChild('path').getValue()}${alignedFilePath}
+---
+<div class="maven-site">
+$bodyContent
+</div>
+
+#if (!$alignedFilePath or $alignedFilePath == 'index.html')
 
+## Custom Variablen einlesen
+#set ( $path = $site.custom.getChild( 'path' ).getValue() )
+#set ( $menuName = $site.custom.getChild( 'menuName' ).getValue() )
 
 ## Seiten einlesen
-#set ( $page = $project.getClass().forName('java.util.LinkedHashMap').newInstance() )
-#set ( $sinkhole = $page.put("uri", "index.html") )
-#set ( $sinkhole = $page.put("name", "$project.name") )
-#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 ) )
-#set ( $sinkhole = $page.put("crumbs", $crumbs ) )
-#set ( $sinkhole = $pages.put($page.uri, $page) )
-#set ( $sinkhole = $stack.push($page) )
-#foreach ( $menu in $decoration.body.menus )
-  ## Nur benannte Menüs werden berücksichtigt
-  #if ($menu.name)
-    #buildPages ( $menu )
+#foreach ( $menu in $site.body.menus )
+  ## Zuerst alle anderen Menüs verarbeiten
+  #if ($menu.name != $menuName)
+    #foreach ( $item in $menu.items )
+      #buildPages ( $item )
+    #end
   #end
 #end
-#foreach ( $menu in $decoration.body.menus )
-  ## Nur unbenannte Menüs werden berücksichtigt
-  #if (!($menu.name))
-    #buildPages ( $menu )
+#foreach ( $menu in $site.body.menus )
+  ## Danach dann das Haupt-Menü einlesen
+  ## Durch diese Reihenfolge überschreiben Referenzen die automatisch erzeugten Einträge nicht
+  #if ($menu.name == $menuName)
+    #foreach ( $item in $menu.items )
+      #buildPages ( $item )
+    #end
   #end
 #end
 
-## Custom Variablen einlesen
-#set ( $pathPrefix = $decoration.custom.getChild( 'thymeproxy' ).getChild( 'prefix' ).getValue() )
-#if ( !$pathPrefix )
-  #set ( $pathPrefix = "" )
+<!--
+MAVEN-NAVIGATION-BEGIN
+{
+#if ( $project.name )
+  "project": "$project.name",
 #end
-#set ( $canonicalPath = $decoration.custom.getChild( 'thymeproxy' ).getChild( 'path' ).getValue() )
-#if ( !$canonicalPath )
-  #set ( $canonicalPath = "" )
-  <!-- WARNING: configuration parameter "path" is not set -->
+#if ( $project.description )
+  "description": "$project.description",
 #end
-#if ( $decoration.custom.getChild( 'thymeproxy' ).getChild( 'flat' ).getValue() )
-  <!-- Generating a flat link-structure (the configuration properties "path" and "prefix" are ignored -->
-  #set ( $sitePath = $canonicalPath )
-#else
-  #set ( $sitePath = $pathPrefix + $canonicalPath + $project.version + "/" )
+#if ( $path )
+  "path": "$path",
 #end
-#set ( $siteCrumbs = $decoration.custom.getChild( 'thymeproxy' ).getChild( 'crumbs' ).getValue() )
-#set ( $command = $decoration.custom.getChild( 'thymeproxy' ).getChild( 'command' ).getValue() )
-#if ( !$command )
-  #set ( $command = "" )
-  <!-- WARNING: configuration parameter "command" is not set -->
+  "pages": [#set( $page_sep="")#foreach( $page in $pages )$page_sep
+    {
+#if ( $page.name )
+      "name": "$page.name",
 #end
-
-<!-- name: $pages.get($alignedFileName).name -->
-<!-- title: $title -->
-<!-- short title: $shortTitle -->
-<!-- current page: $alignedFileName -->
-<!-- path: $sitePath -->
-<!-- crumbs: $siteCrumbs -->
-<!-- pages: $pages -->
-
-
-<!--*/-->
-<html xmlns="http://www.w3.org/1999/xhtml" $command>
-  <head>
-    <title class="title">$title</title>
-    <meta http-equiv="Content-Type" content="text/html; charset=${outputEncoding}" />
-    <link id="canonical" rel="canonical" href="$canonicalPath$alignedFileName"/>
-  </head>
-  <body>
-    <h1 class="short_title">$shortTitle</h1>
-    <h2>URI</h2>
-    <ul>
-      <li><strong>site:</strong> <code class="site_uri">$sitePath$alignedFileName</code></li>
-      <li><strong>canonical:</strong> <code class="canonical_uri">$canonicalPath$alignedFileName</code></li>
-      <li><strong>relative:</strong> <code class="relative_uri">$alignedFileName</code></li>
-    </ul>
-    <h2>Path</h2>
-    <p>
-      <ol>
-        #foreach($crumb in $pages.get($alignedFileName).crumbs)<li><a href="$crumb.uri">$crumb.name</a></li>#end
-      </ol>
-    </p>
-    <hr />
-    <article class="maincontent">
-      $bodyContent
-    </article>
-    <hr />
-    <h2>Page Structure as JSON</h2>
-    <pre class="json">
-{
-  "_titles": {#set($sep = "")#foreach($page in $pages)$sep
-    "$sitePath$page.uri": "$page.name"#set($sep = ",")
+#if ( $page.href )
+      "href": "$page.href",
 #end
-
-  },
-  "_childs": {#set($sep = "")#foreach($page in $pages)#if(!$page.childs.isEmpty())$sep
-    "$sitePath$page.uri": [#set($csep = "")#foreach($child in $page.childs.entrySet())$csep
-      "$sitePath$child.key"#set($csep = ",")#end
-
-    ]#set($sep = ",")#end#end
-
-  },
-  "_crumbs": {#set($sep = "")#foreach($page in $pages)$sep
-    "$sitePath$page.uri": [
-#set($csep = "")#if($siteCrumbs)
-      $siteCrumbs#set($csep = ",")#end#set($last = "")#foreach($crumb in $page.crumbs)#if($sitePath+$crumb.uri != $last)$csep
-      "$sitePath$crumb.uri"#set($csep = ",")#set($last = $sitePath+$crumb.uri)#end#end
-
-    ]#set($sep = ",")#end
-
-  },
-  "_canonical": {#set($sep = "")#foreach($page in $pages)$sep
-    "$sitePath$page.uri": "$canonicalPath$page.uri"#set($sep = ",")
+#if ( $page.image )
+      "image": "",
 #end
-
-  }
+      "childs": [#set( $child_sep="")#foreach( $uri in $page.childs )$child_sep
+        "$uri"#set($child_sep=",")
+#end
+      ],
+      "crumbs": [#set( $crumb_sep="")#foreach( $uri in $page.crumbs )$crumb_sep
+        "$uri"#set($crumb_sep=",")
+#end
+      ]
+    }#set($page_sep=",")
+#end
+  ]
 }
-    </pre>
-    <h2>All Pages</h2>
-    <p>
-      <ul>
-        #foreach($page in $pages)<li><a href="$page.uri">$page.name</a></li>#end
-      </ul>
-    </p>
-  </body>
-</html>
+MAVEN-NAVIGATION-END
+-->
+#end