Skip to content

Commit 048d742

Browse files
multi-groups
Signed-off-by: Craig <[email protected]> landing page and nav Signed-off-by: Craig <[email protected]>
1 parent bbe6bc4 commit 048d742

File tree

6 files changed

+234
-78
lines changed

6 files changed

+234
-78
lines changed

content/manuals/_index.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ params:
1313
- AI
1414
- Products
1515
- Platform
16+
- Desktop
1617
notoc: true
1718
open-source:
1819
- title: Docker Build

content/manuals/ai/mcp-catalog-and-toolkit/_index.md

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,10 @@ title: Docker MCP Catalog and Toolkit
33
linkTitle: MCP Catalog and Toolkit
44
params:
55
sidebar:
6-
group: AI
6+
group:
7+
- AI
8+
- Products
9+
- Desktop
710
badge:
811
color: blue
912
text: Beta

content/manuals/desktop/_index.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,9 @@ keywords: how to use docker desktop, what is docker desktop used for, what does
66
desktop do, using docker desktop
77
params:
88
sidebar:
9-
group: Products
9+
group:
10+
- Products
11+
- Desktop
1012
grid:
1113
- title: Install Docker Desktop
1214
description: |

layouts/_default/baseof.html

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -50,10 +50,13 @@
5050
Back
5151
</button>
5252
<!-- Actual Sidebar Content -->
53-
{{ block "left" . }}
54-
{{ partial "sidebar/mainnav.html" . }}
55-
{{ partial "sidebar/sections.html" . }}
56-
{{ end }}
53+
{{ block "left" . }}
54+
{{ partial "sidebar/mainnav.html" . }}
55+
{{/* only skip sections.html when we're on exactly /manuals/ */}}
56+
{{ if ne .RelPermalink "/manuals/" }}
57+
{{ partial "sidebar/sections.html" . }}
58+
{{ end }}
59+
{{ end }}
5760
</div>
5861
</div>
5962

layouts/partials/sidebar/sections.html

Lines changed: 56 additions & 72 deletions
Original file line numberDiff line numberDiff line change
@@ -11,35 +11,41 @@
1111
<div class="block py-4 text-gray-200 md:hidden dark:text-gray-200">
1212
This section
1313
</div>
14-
<ul>
15-
{{- $first := .FirstSection }}
16-
{{- if eq $first.Title "Manuals" }}
17-
{{- if eq page $first }}
18-
{{/* 1) On /manuals/ → grouped flat list (unchanged) */}}
19-
{{- $sections := $first.Sections }}
20-
{{- $ungrouped := where $sections "Params.sidebar.group" "==" nil }}
21-
{{- range $ungrouped }}{{ template "renderSingle" . }}{{- end }}
22-
{{- range $first.Params.sidebar.groups }}
23-
<div class="navbar-group">
24-
<li class="navbar-group-font-title">{{ . }}</li>
25-
{{- range where $sections "Params.sidebar.group" . }}
26-
{{ template "renderSingle" . }}
14+
<ul>
15+
{{- $first := .FirstSection }}
16+
{{- if eq $first.Title "Manuals" }}
17+
{{- if eq page $first }}
18+
{{/* 1) On /manuals/ → list all manuals, grouped by Params.sidebar.groups (multi-group supported) */}}
19+
{{- $sections := $first.Sections }}
20+
{{- /* Manuals without any group */}}
21+
{{- $ungrouped := where $sections "Params.sidebar.group" "==" nil }}
22+
{{- range $ungrouped }}
23+
{{ template "renderSingle" . }}
24+
{{- end }}
25+
{{- /* Then each declared group, allowing multiple groups per manual */}}
26+
{{- range $group := $first.Params.sidebar.groups }}
27+
<div class="navbar-group">
28+
<li class="navbar-group-font-title">{{ $group }}</li>
29+
{{- range $sections }}
30+
{{- if in .Params.sidebar.group $group }}
31+
{{ template "renderSingle" . }}
32+
{{- end }}
33+
{{- end }}
34+
</div>
35+
{{- end }}
36+
{{- else }}
37+
{{/* 2) Under a specific manual → render that manual’s full collapsible tree */}}
38+
{{- range $first.Sections }}
39+
{{- if or (eq page .) (page.IsDescendant .) }}
40+
{{ template "renderList" . }}
2741
{{- end }}
28-
</div>
29-
{{- end }}
30-
{{- else }}
31-
{{/* 2) Under a manual → show that manual’s entire tree */}}
32-
{{- range $first.Sections }}
33-
{{- if or (eq page .) (page.IsDescendant .) }}
34-
{{ template "renderList" . }}
3542
{{- end }}
3643
{{- end }}
44+
{{- else }}
45+
{{/* 3) Everywhere else → normal recursive nav of FirstSection */}}
46+
{{ template "renderChildren" $first }}
3747
{{- end }}
38-
{{- else }}
39-
{{/* 3) Everywhere else → normal recursive nav */}}
40-
{{ template "renderChildren" $first }}
41-
{{- end }}
42-
</ul>
48+
</ul>
4349
</nav>
4450

4551
{{ define "renderChildren" }}
@@ -55,17 +61,17 @@
5561
{{- template "renderSingle" . }}
5662
{{- end }}
5763
{{- end }}
58-
{{- range .Params.sidebar.groups }}
59-
<!-- Main titles -->
64+
{{- /* grouping, allowing multiple groups per page */}}
65+
{{- range $group := .Params.sidebar.groups }}
6066
<div class="navbar-group">
61-
<li class="navbar-group-font-title">
62-
{{ . }}
63-
</li>
64-
{{- range where $pages "Params.sidebar.group" . }}
65-
{{- if .IsSection }}
66-
{{- template "renderList" . }}
67-
{{- else }}
68-
{{- template "renderSingle" . }}
67+
<li class="navbar-group-font-title">{{ $group }}</li>
68+
{{- range $pages }}
69+
{{- if in .Params.sidebar.group $group }}
70+
{{- if .IsSection }}
71+
{{- template "renderList" . }}
72+
{{- else }}
73+
{{- template "renderSingle" . }}
74+
{{- end }}
6975
{{- end }}
7076
{{- end }}
7177
</div>
@@ -76,26 +82,19 @@
7682
{{ define "renderList" }}
7783
{{ $isCurrent := eq page . }}
7884
{{ $expanded := or $isCurrent (page.IsDescendant .) }}
79-
<li class="" x-data="{ expanded: {{ $expanded }} }">
80-
<div
81-
class="{{ if $isCurrent }}
82-
navbar-entry-background-current
83-
{{ end }} flex w-full items-center justify-between rounded-sm"
84-
>
85+
<li x-data="{ expanded: {{ $expanded }} }">
86+
<div class="{{ if $isCurrent }}navbar-entry-background-current{{ end }}
87+
flex w-full items-center justify-between rounded-sm">
8588
<div class="navbar-entry-margin w-full truncate">
8689
{{- if .Permalink }}
87-
<!-- Sections that have children and linking to a page -->
8890
<a
89-
{{ if $isCurrent }}
90-
aria-current="page" id="sidebar-current-page"
91-
{{ end }}
91+
{{ if $isCurrent }}aria-current="page" id="sidebar-current-page"{{ end }}
9292
class="hover:text-blue block select-none hover:dark:text-blue-400"
9393
href="{{ .Permalink }}"
9494
>
9595
{{ template "renderTitle" . }}
9696
</a>
9797
{{- else }}
98-
<!-- Sections that have children and do not link to a page -->
9998
<button
10099
@click="expanded = !expanded"
101100
class="hover:text-blue w-full text-left select-none hover:dark:text-blue-400"
@@ -104,29 +103,20 @@
104103
</button>
105104
{{- end }}
106105
</div>
107-
<!-- Expand/collapse button -->
108-
<button
109-
@click="expanded = !expanded"
110-
class="rounded-sm hover:bg-gray-200 hover:dark:bg-gray-800"
111-
>
112-
<span
113-
:class="{ 'hidden' : expanded }"
114-
class="icon-svg {{ if $expanded }}hidden{{ end }}"
115-
>
106+
<button @click="expanded = !expanded"
107+
class="rounded-sm hover:bg-gray-200 hover:dark:bg-gray-800">
108+
<span :class="{ 'hidden': expanded }"
109+
class="icon-svg {{ if $expanded }}hidden{{ end }}">
116110
{{ partialCached "icon" "arrow_drop_down" "arrow_drop_down" }}
117111
</span>
118-
<span
119-
:class="{ 'hidden' : !expanded }"
120-
class="icon-svg {{ if not $expanded }}hidden{{ end }}"
121-
>
112+
<span :class="{ 'hidden': !expanded }"
113+
class="icon-svg {{ if not $expanded }}hidden{{ end }}">
122114
{{ partialCached "icon" "arrow_drop_up" "arrow_drop_up" }}
123115
</span>
124116
</button>
125117
</div>
126-
<ul
127-
:class="{ 'hidden' : !expanded }"
128-
class="{{ if not $expanded }}hidden{{ end }} ml-3"
129-
>
118+
<ul :class="{ 'hidden': !expanded }"
119+
class="{{ if not $expanded }}hidden{{ end }} ml-3">
130120
{{ template "renderChildren" . }}
131121
</ul>
132122
</li>
@@ -145,15 +135,9 @@
145135
</li>
146136
{{- else }}
147137
{{ $isCurrent := eq page . }}
148-
<li
149-
class="navbar-entry-margin hover:text-blue {{ if $isCurrent }}
150-
navbar-entry-background-current
151-
{{ end }} rounded-sm hover:dark:text-blue-400"
152-
>
138+
<li class="navbar-entry-margin hover:text-blue {{ if $isCurrent }}navbar-entry-background-current{{ end }} rounded-sm hover:dark:text-blue-400">
153139
<a
154-
{{ if $isCurrent }}
155-
aria-current="page" id="sidebar-current-page"
156-
{{ end }}
140+
{{ if $isCurrent }}aria-current="page" id="sidebar-current-page"{{ end }}
157141
class="block w-full truncate"
158142
href="{{ .Permalink }}"
159143
title="{{ .LinkTitle }}"
@@ -168,7 +152,7 @@
168152
{{ .LinkTitle }}
169153
{{- with .Params.sidebar.badge }}
170154
<span>
171-
{{- partial "components/badge.html" (dict "color" .color "content" .text) }}
155+
{{ partial "components/badge.html" (dict "color" .color "content" .text) }}
172156
</span>
173157
{{- end }}
174158
{{ end }}

0 commit comments

Comments
 (0)