Skip to content

Commit d99899e

Browse files
shalkclaudepront
authored
fix(website): fix docs sidebar expand/collapse navigation (#25238)
- Use strings.HasPrefix to keep sections expanded when on any child page (the previous eq check only matched the section index, not child pages) - Add @click="open = true" to section title links so clicking the title expands the group in addition to navigating, without requiring the chevron Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com> Co-authored-by: Pavlos Rontidis <pavlos.rontidis@gmail.com>
1 parent 29b17aa commit d99899e

1 file changed

Lines changed: 5 additions & 2 deletions

File tree

website/layouts/partials/docs/sidebar.html

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,10 +47,13 @@
4747
{{ define "subsection-group" }}
4848
{{ $here := .here }}
4949
{{ $section := .section }}
50-
{{ $open := or (.ctx.IsAncestor $section) (eq .ctx.RelPermalink $here) }}
50+
{{ $open := or (.ctx.IsAncestor $section) (strings.HasPrefix $here .ctx.RelPermalink) }}
51+
{{ $isActive := eq .ctx.RelPermalink $here }}
5152
<div x-data="{ open: {{ $open }} }">
5253
<span class="flex justify-between items-center">
53-
{{ template "link" (dict "here" $here "url" .ctx.RelPermalink "title" (.ctx.Params.short | default .ctx.Title)) }}
54+
<a href="{{ .ctx.RelPermalink }}" @click="open = true" class="flex-1 text-gray-800 font-semibold tracking-tight dark:text-gray-400 dark:hover:text-purple-v hover:text-purple-v{{ if $isActive }} font-bold text-secondary dark:text-primary{{ end }}">
55+
{{ .ctx.Params.short | default .ctx.Title }}
56+
</a>
5457
{{ template "chevron-icon" }}
5558
</span>
5659

0 commit comments

Comments
 (0)