diff --git a/.gitmodules b/.gitmodules index 771ed3fc6bf54..7028b79fbe7b1 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,7 +1,7 @@ [submodule "themes/docsy"] path = themes/docsy url = https://github.com/google/docsy.git - branch = v0.2.0 + branch = v0.3.0 [submodule "api-ref-generator"] path = api-ref-generator url = https://github.com/kubernetes-sigs/reference-docs diff --git a/hugo.toml b/hugo.toml index 13ba477cc9414..b0fde0b773f28 100644 --- a/hugo.toml +++ b/hugo.toml @@ -218,6 +218,8 @@ url = "https://v1-27.docs.kubernetes.io" [params.ui] # Enable to show the side bar menu in its compact state. sidebar_menu_compact = false +# Show this many levels in compact mode +ul_show = 3 # Show expand/collapse icon for sidebar sections. sidebar_menu_foldable = true # https://github.com/gohugoio/hugo/issues/8918#issuecomment-903314696 diff --git a/layouts/partials/sidebar-tree.html b/layouts/partials/sidebar-tree.html index f8ce9b468e7ff..ae6f622df611c 100644 --- a/layouts/partials/sidebar-tree.html +++ b/layouts/partials/sidebar-tree.html @@ -1,36 +1,35 @@ -{{/* We cache this partial for bigger sites and set the active class client side. */}} -{{ $sidebarCacheLimit := cond (isset .Site.Params.ui "sidebar_cache_limit") .Site.Params.ui.sidebar_cache_limit 2000 -}} -{{ $shouldDelayActive := ge (len .Site.Pages) $sidebarCacheLimit -}} +{{/* Always cache this partial; set the active class client side. */}} +{{ $shouldDelayActive := true }}
{{ if not .Site.Params.ui.sidebar_search_disable -}} {{ else -}}
{{ end -}}
@@ -42,9 +41,10 @@ {{ $treeRoot := cond (eq .ulNr 0) true false -}} {{ $ulNr := .ulNr -}} {{ $ulShow := .ulShow -}} + {{ $currentLang := .currentLang -}} {{ $active := and (not $shouldDelayActive) (eq $s $p) -}} {{ $activePath := and (not $shouldDelayActive) ($p.IsDescendant $s) -}} - {{ $show := cond (or (lt $ulNr $ulShow) $activePath (and (not $shouldDelayActive) (eq $s.Parent $p.Parent)) (and (not $shouldDelayActive) (eq $s.Parent $p)) (and (not $shouldDelayActive) ($p.IsDescendant $s.Parent))) true false -}} + {{ $show := cond (or (lt $ulNr $ulShow) $activePath (and (not $shouldDelayActive) (eq $s.Parent $p.Parent)) (and (not $shouldDelayActive) (eq $s.Parent $p)) (not $p.Site.Params.ui.sidebar_menu_compact) (and (not $shouldDelayActive) ($p.IsDescendant $s.Parent))) true false -}} {{ $mid := printf "m-%s" ($s.RelPermalink | anchorize) -}} {{ $pages_tmp := where (union $s.Pages $s.Sections).ByWeight ".Params.toc_hide" "!=" true -}} {{/* We get untranslated subpages below to make sure we build all levels of the sidenav in localizationed docs sets */}} @@ -60,44 +60,26 @@ {{ $withChild := gt (len $pages) 0 -}} {{ $manualLink := cond (isset $s.Params "manuallink") $s.Params.manualLink ( cond (isset $s.Params "manuallinkrelref") (relref $s $s.Params.manualLinkRelref) $s.RelPermalink) -}} {{ $manualLinkTitle := cond (isset $s.Params "manuallinktitle") $s.Params.manualLinkTitle $s.Title -}} - + {{ $isForeignLanguage := (ne (string $s.Lang) ($.currentLang)) -}}
  • {{ if (and $p.Site.Params.ui.sidebar_menu_foldable (ge $ulNr 1)) -}} - - + + {{ else -}} - {{ if not $treeRoot }} - {{ with $s.Params.Icon}}{{ end }}{{ $s.LinkTitle }} - {{ end -}} - {{ end -}} - {{ if $withChild -}} - {{ $ulNr := add $ulNr 1 -}} - + {{ if not $treeRoot }} + {{ with $s.Params.Icon}}{{ end }}{{ $s.LinkTitle }}{{ if $isForeignLanguage }} ({{ $s.Lang | upper }}){{ end -}} + {{- end }} + {{- end }} + {{- if $withChild }} + {{- $ulNr := add $ulNr 1 }} + {{- end }}
  • -{{- end }} +{{- end }} \ No newline at end of file diff --git a/themes/docsy b/themes/docsy index 1c77bb2448394..9f55cf34808d7 160000 --- a/themes/docsy +++ b/themes/docsy @@ -1 +1 @@ -Subproject commit 1c77bb24483946f11c13f882f836a940b55ad019 +Subproject commit 9f55cf34808d720bcfff9398c9f9bb7fd8fce4ec