]> juplo.de Git - website/commitdiff
WIP:fix2
authorKai Moritz <kai.milan.moritz@googlemail.com>
Fri, 19 Jun 2026 10:22:34 +0000 (12:22 +0200)
committerKai Moritz <kai.milan.moritz@googlemail.com>
Fri, 19 Jun 2026 10:22:34 +0000 (12:22 +0200)
src/components/BlogNav.astro
src/content.config.ts
src/content/projects/hibernate-maven-plugin/2.1.1/create-mojo.html [new file with mode: 0644]
src/content/projects/hibernate-maven-plugin/2.1.1/drop-mojo.html [new file with mode: 0644]
src/content/projects/hibernate-maven-plugin/2.1.1/help-mojo.html [new file with mode: 0644]
src/content/projects/hibernate-maven-plugin/2.1.1/update-mojo.html [new file with mode: 0644]
src/lib/projects.ts

index 8508f2aaaa9d6134651890742084de673f596f4b..b398e671687ecd35c7af25876957034df09f8e94 100644 (file)
@@ -57,15 +57,18 @@ function inSubtree<T extends { url: string; children?: T[] }>(node: T, url: stri
 // A nav item is visible (not off) when it is: current, ancestor of current,
 // sibling of current (only when current is not a section-index node), or child of current.
 // `inPath` = inSubtree(node, currentUrl), pre-computed by the caller to avoid double traversal.
+// `isAlias` = true for nav-only stub entries: isCurrent and isAncestor are suppressed so the
+// alias is hidden in Classic layout when its page is active (the canonical entry handles that).
 function nodeOff(
   nodeUrl: string,
   parentUrl: string,
   inPath: boolean,
   currentParentUrl: string,
   currentIsNode: boolean,
+  isAlias = false,
 ): boolean {
-  const isCurrent  = nodeUrl === currentUrl;
-  const isAncestor = inPath && !isCurrent;
+  const isCurrent  = !isAlias && nodeUrl === currentUrl;
+  const isAncestor = !isAlias && inPath && !isCurrent;
   const isSibling  = parentUrl === currentParentUrl && !currentIsNode;
   const isChild    = parentUrl === currentUrl;
   return !(isCurrent || isAncestor || isSibling || isChild);
@@ -142,8 +145,8 @@ const activeProjectCurrentIsNode = activeProjectCurrentNode?.isNode ?? false;
 
 // Partial application of nodeOff bound to the Projects subtree's current-page context
 const _projCurrentParentUrl = activeProjectCurrentParent?.url ?? '';
-const projNodeOff = (nodeUrl: string, parentUrl: string, inPath: boolean) =>
-  nodeOff(nodeUrl, parentUrl, inPath, _projCurrentParentUrl, activeProjectCurrentIsNode);
+const projNodeOff = (nodeUrl: string, parentUrl: string, inPath: boolean, isAlias = false) =>
+  nodeOff(nodeUrl, parentUrl, inPath, _projCurrentParentUrl, activeProjectCurrentIsNode, isAlias);
 
 // ── Blog URL classification ────────────────────────────────────────────────────
 const mainSections = [
@@ -355,10 +358,10 @@ const activeTagSlug  = onTagTerm      ? currentUrl.replace(/^\/tags\//, '').repl
               <ul class={`s${rootInPath ? ' active' : ''}`}>
                 {root.children.map(child => {
                   const childInPath = inSubtree(child, currentUrl);
-                  const childOff    = projNodeOff(child.url, root.url, childInPath);
+                  const childOff    = projNodeOff(child.url, root.url, childInPath, child.isAlias);
                   const childIsNode = child.isNode;
                   return (
-                    <li class={`s${childIsNode ? ' sub' : ''}${childOff ? ' off' : ''}`}>
+                    <li class={`s${childIsNode ? ' sub' : ''}${child.isAlias ? ' alias' : ''}${childOff ? ' off' : ''}`}>
                       {child.url === currentUrl
                         ? <strong class="s">{child.title}</strong>
                         : <a href={child.url} class={childInPath ? 's selected' : 's'}>
@@ -369,10 +372,10 @@ const activeTagSlug  = onTagTerm      ? currentUrl.replace(/^\/tags\//, '').repl
                         <ul class={`s${childInPath ? ' active' : ''}`}>
                           {child.children.map(grand => {
                             const grandInPath = inSubtree(grand, currentUrl);
-                            const grandOff    = projNodeOff(grand.url, child.url, grandInPath);
+                            const grandOff    = projNodeOff(grand.url, child.url, grandInPath, grand.isAlias);
                             const grandIsNode = grand.isNode;
                             return (
-                              <li class={`s${grandIsNode ? ' sub' : ''}${grandOff ? ' off' : ''}`}>
+                              <li class={`s${grandIsNode ? ' sub' : ''}${grand.isAlias ? ' alias' : ''}${grandOff ? ' off' : ''}`}>
                                 {grand.url === currentUrl
                                   ? <strong class="s">{grand.title}</strong>
                                   : <a href={grand.url} class={grandInPath ? 's selected' : 's'}>
@@ -383,9 +386,9 @@ const activeTagSlug  = onTagTerm      ? currentUrl.replace(/^\/tags\//, '').repl
                                   <ul class={`s${grandInPath ? ' active' : ''}`}>
                                     {grand.children.map(ggrand => {
                                       const ggInPath = ggrand.url === currentUrl;
-                                      const ggOff    = projNodeOff(ggrand.url, grand.url, ggInPath);
+                                      const ggOff    = projNodeOff(ggrand.url, grand.url, ggInPath, ggrand.isAlias);
                                       return (
-                                        <li class={`s${ggOff ? ' off' : ''}`}>
+                                        <li class={`s${ggrand.isAlias ? ' alias' : ''}${ggOff ? ' off' : ''}`}>
                                           {ggInPath
                                             ? <strong class="s">{ggrand.title}</strong>
                                             : <a href={ggrand.url} class="s">{ggrand.title}</a>
index 079cd458271eb7e97c7c8ac356d3f14c3b9551a8..d07f9e8ff49c0458eff06de0a6b63065903520c2 100644 (file)
@@ -30,6 +30,7 @@ const projectPageSchema = z.object({
   params: z.object({
     current: z.boolean(),
     canonical: z.string().optional(),
+    alias: z.boolean().optional(),
   }),
 });
 
diff --git a/src/content/projects/hibernate-maven-plugin/2.1.1/create-mojo.html b/src/content/projects/hibernate-maven-plugin/2.1.1/create-mojo.html
new file mode 100644 (file)
index 0000000..e96d0e9
--- /dev/null
@@ -0,0 +1,8 @@
+---
+title: "Goal — hibernate:create"
+weight: 21
+url: /hibernate-maven-plugin/create-mojo.html
+params:
+  current: true
+  alias: true
+---
diff --git a/src/content/projects/hibernate-maven-plugin/2.1.1/drop-mojo.html b/src/content/projects/hibernate-maven-plugin/2.1.1/drop-mojo.html
new file mode 100644 (file)
index 0000000..e3a7867
--- /dev/null
@@ -0,0 +1,8 @@
+---
+title: "Goal — hibernate:drop"
+weight: 23
+url: /hibernate-maven-plugin/drop-mojo.html
+params:
+  current: true
+  alias: true
+---
diff --git a/src/content/projects/hibernate-maven-plugin/2.1.1/help-mojo.html b/src/content/projects/hibernate-maven-plugin/2.1.1/help-mojo.html
new file mode 100644 (file)
index 0000000..bf0ea88
--- /dev/null
@@ -0,0 +1,8 @@
+---
+title: "Goal — hibernate:help"
+weight: 24
+url: /hibernate-maven-plugin/help-mojo.html
+params:
+  current: true
+  alias: true
+---
diff --git a/src/content/projects/hibernate-maven-plugin/2.1.1/update-mojo.html b/src/content/projects/hibernate-maven-plugin/2.1.1/update-mojo.html
new file mode 100644 (file)
index 0000000..3fb5223
--- /dev/null
@@ -0,0 +1,8 @@
+---
+title: "Goal — hibernate:update"
+weight: 22
+url: /hibernate-maven-plugin/update-mojo.html
+params:
+  current: true
+  alias: true
+---
index feff57b1ac97eca7ffbfdfdc9db16684337ed6bf..125ee04002814c9281dc292d9b829cdca5bbb999 100644 (file)
@@ -9,6 +9,7 @@ export interface ProjectNavNode {
   url: string;
   weight: number;
   isNode: boolean;   // true when this entry is a section (_index.html)
+  isAlias: boolean;  // true for nav-only stub entries (same url as canonical, empty body)
   children: ProjectNavNode[];
 }
 
@@ -92,6 +93,7 @@ function buildNavTree(
       url:   entry.data.url,
       weight: entry.data.weight,
       isNode,
+      isAlias: entry.data.params.alias ?? false,
       children,
     };
   }