Skip to content

Commit eb41508

Browse files
authored
Improve documentation website UX (#1751)
As we added more tutorials and new services to ACK and our documentation website, it got harder to navigate throught the docs menu. This update improves the UX by tweaking the `docs-menu.html` and `reference-menu-item.html` files to make it easier to use the pages sections. This patch bring mainly two changes: - On the `Documentation` page, all the sections (except the active one) are collapsed by default. No more getting lost in a sea of sections! - On the `API References` page, the expand icon now correctly shows the status of the section/subsection (expanded/unexpanded), when selecting a new CRD. By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
1 parent ec3ef0b commit eb41508

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

docs/layouts/partials/sidebar/docs-menu.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,11 @@
55
{{- $active := or ($currentPage.IsMenuCurrent "docs" .) ($currentPage.HasMenuCurrent "docs" .) -}}
66
{{- $active = or $active (eq $currentPage.Section .Identifier) -}}
77
<li class="mb-1">
8-
<button class="btn btn-toggle align-items-center rounded collapsed" data-bs-toggle="collapse" data-bs-target="#section-{{ .Identifier }}" aria-expanded="true">
8+
<button class="btn btn-toggle align-items-center rounded{{ if not $active }} collapsed{{ end }}" data-bs-toggle="collapse" data-bs-target="#section-{{ .Identifier }}" aria-expanded="{{ if not $active }}false{{ else }}true{{ end }}">
99
{{ .Name }}
1010
</button>
1111
{{ if .HasChildren -}}
12-
<div class="collapse show" id="section-{{ .Identifier }}">
12+
<div class="collapse{{ if $active }} show{{ else }} collapsed{{ end }}" id="section-{{ .Identifier }}">
1313
<ul class="btn-toggle-nav list-unstyled fw-normal pb-1 small">
1414
{{ range .Children -}}
1515
{{- $active := or ($currentPage.IsMenuCurrent "docs" .) ($currentPage.HasMenuCurrent "docs" .) -}}

docs/layouts/partials/sidebar/reference-menu-item.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
{{ $root := . }}
22
<li class="mb-1">
33
{{ $serviceActive := eq $root.currentService $root.service.name }}
4-
<button class="btn btn-toggle align-items-center rounded {{ if not $serviceActive }} collapsed{{ end }}" data-bs-toggle="collapse" data-bs-target="#section-{{ .service.name }}" aria-expanded="{{ if not $root.serviceActive }} false{{ else }}true{{ end }}">
4+
<button class="btn btn-toggle align-items-center rounded {{ if not $serviceActive }} collapsed{{ end }}" data-bs-toggle="collapse" data-bs-target="#section-{{ .service.name }}" aria-expanded="{{ if not $serviceActive }} false{{ else }}true{{ end }}">
55
{{ $root.service.service_metadata.service.short_name }}
66
</button>
7-
<div class="collapse position-relative{{ if $serviceActive }} show{{ end }}" id="section-{{ $root.service.name }}">
7+
<div class="collapse position-relative{{ if not $serviceActive }} collapsed{{ else }} show{{ end }}" id="section-{{ $root.service.name }}" aria-expanded="{{ if not $root.serviceActive }} false{{ else }} true{{ end }}">
88
{{ range $api_version := sort $root.service.service_metadata.api_versions }}
99
{{ $versionActive := and $serviceActive (eq $root.currentVersion ($api_version.api_version | lower)) }}
1010
<button class="btn btn-toggle align-items-center rounded ms-2 small{{ if not $versionActive }} collapsed{{ end }}" data-bs-toggle="collapse" data-bs-target="#section-{{ $root.service.name }}-{{ $api_version.api_version }}" aria-expanded="{{ if not $versionActive }} false{{ else }}true{{ end }}">

0 commit comments

Comments
 (0)