Skip to content

Commit 466db49

Browse files
update nav dropdown behavior (docker#23436)
<!--Delete sections as needed --> ## Description Change how the section drop-down arrows are rendered in the side-nav. Currently, they generate for any folder, even if it just contains an index. To not generate the arrow, the index would have to be taken out of the folder and renamed as the folder. This change now counts how many children under the index, and only generates the arrow if it has children (that aren't hidden from the nav). For example, see how there is an arrow for the mcp gateway, but it expands to nothing. Current: https://docs.docker.com/ai/mcp-gateway/ Updated: https://deploy-preview-23436--docsdocker.netlify.app/ai/mcp-gateway/ ## Related issues or tickets <!-- Related issues, pull requests, or Jira tickets --> ## Reviews <!-- Notes for reviewers here --> <!-- List applicable reviews (optionally @tag reviewers) --> - [ ] Editorial review Signed-off-by: Craig <[email protected]>
1 parent 2c0d6fd commit 466db49

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

layouts/partials/sidebar/sections.html

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,9 @@
7979
</button>
8080
{{- end }}
8181
</div>
82+
{{/* Only show expand group button if section has children */}}
83+
{{- $hasChildren := gt (len (where .Pages "Params.sitemap" "ne" "false")) 0 }}
84+
{{- if $hasChildren }}
8285
<!-- Expand group button -->
8386
<button
8487
@click="expanded = !expanded"
@@ -97,6 +100,7 @@
97100
{{ partialCached "icon" "arrow_drop_up" "arrow_drop_up" }}
98101
</span>
99102
</button>
103+
{{- end }}
100104
</div>
101105
<ul
102106
:class="{ 'hidden' : !expanded }"

0 commit comments

Comments
 (0)