2020-04-04 23:25:53 +00:00
<!-- note, this is only used in /docs -->
2021-08-02 16:53:52 +00:00
{{/* minikube hack: temporarily forked from
docsy/layouts/partials/sidebar-tree.html for hugo v0.69 compatibility */}} {{/*
We cache this partial for bigger sites and set the active class client side.
*/}} {{ $shouldDelayActive := ge (len .Site.Pages) 2000 }}
< div
id="td-sidebar-menu"
class="td-sidebar__inner{{ if $shouldDelayActive }} d-none{{ end }}"
>
2020-03-31 02:31:17 +00:00
{{ if not .Site.Params.ui.sidebar_search_disable }}
< form class = "td-sidebar__search d-flex align-items-center" >
{{ partial "search-input.html" . }}
2021-08-02 16:53:52 +00:00
< button
class="btn btn-link td-sidebar__toggle d-md-none p-0 ml-3 fas fa-bars"
type="button"
data-toggle="collapse"
data-target="#td-section-nav"
aria-controls="td-docs-nav"
aria-expanded="false"
aria-label="Toggle section navigation"
>< / button >
2020-03-31 02:31:17 +00:00
< / form >
{{ end }}
2020-12-01 19:30:51 +00:00
< nav class = "collapse td-sidebar-nav" id = "td-section-nav" >
2021-08-02 16:53:52 +00:00
{{ if (gt (len .Site.Home.Translations) 0) }}
2020-03-31 02:31:17 +00:00
< div class = "nav-item dropdown d-block d-lg-none" >
{{ partial "navbar-lang-selector.html" . }}
< / div >
2021-08-02 16:53:52 +00:00
{{ end }} {{ template "section-tree-nav-section" (dict "page" . "section"
.FirstSection "delayActive" $shouldDelayActive) }}
2020-03-31 02:31:17 +00:00
< / nav >
< / div >
2020-04-04 23:25:53 +00:00
<!-- this gets called for every section -->
2021-08-02 16:53:52 +00:00
{{ define "section-tree-nav-section" }} {{ $s := .section }} {{ $p := .page }}
{{ $shouldDelayActive := .delayActive }} {{ $activeSection := eq
$p.CurrentSection $s }} {{/* minikube hack: Override $showSection due to a Hugo
upgrade bug */}} {{ $showSection := false }} {{ $expandSection := false }} {{
$sid := $s.RelPermalink | anchorize }} {{ $sectionParent := $s.Parent.Title |
anchorize }} {{ $csid := $p.CurrentSection.Title | anchorize }} {{ if
$p.IsDescendant $s }}
<!-- page is within current section -->
{{ $showSection = true }} {{ else if eq $sectionParent "minikube" }}
<!-- top - level section -->
{{ $showSection = true }} {{ else if eq $sectionParent "welcome" }}
<!-- top - level documentation -->
{{ $showSection = true }} {{ else if eq $sectionParent "handbook" }}
<!-- handbook link -->
{{ $showSection = true }} {{ else if eq $p.CurrentSection $s.Parent }}
<!-- page is in current sections parent -->
{{ $showSection = true }} {{ else if $p.Parent.IsAncestor $s }}
<!-- page is in current section -->
{{ if eq $s $p.CurrentSection }} {{ $showSection = true }} {{ end }} {{ end }}
2020-03-31 02:31:17 +00:00
2020-04-04 23:25:53 +00:00
<!-- only show top - level sections, or sections within the current section -->
2021-08-02 16:53:52 +00:00
{{/* end minikube hack */}} {{ $sid := $s.RelPermalink | anchorize }} {{ if
$showSection }}
< ul class = "td-sidebar-nav__section pr-md-3" >
< li class = "td-sidebar-nav__section-title" >
<!-- Link for subections -->
< a
href="{{ $s.RelPermalink }}"
class="align-left pl-0 pr-2{{ if not $expandSection }} collapsed{{ end }}{{ if $activeSection}} active{{ end }} td-sidebar-link td-sidebar-link__section"
>
{{ if $activeSection}} ⦿ {{ else }} ⦾ {{ end }}
{{$s.LinkTitle }}< /a
>
< / li >
< ul >
< li class = "collapse {{ if $showSection }}show{{ end }}" id = "{{ $sid }}" >
{{ $pages := where (union $s.Pages $s.Sections).ByWeight
".Params.toc_hide" "!=" true }} {{ $pages := $pages | first 50 }} {{ range
$pages }} {{ if .IsPage }} {{ $mid := printf "m-%s" (.RelPermalink |
anchorize) }} {{/* minikube hack: Override $activeSection due to a Hugo
upgrade bug */}} {{ $showPage := false }} {{ $activePage := false }}
2020-03-31 02:31:17 +00:00
2021-08-02 16:53:52 +00:00
<!-- always show pages in the current section -->
{{ if $activeSection }} {{ $showPage = true }} {{ $activePage = eq . $p }}
{{ end }}
2020-04-04 23:25:53 +00:00
2021-08-02 16:53:52 +00:00
<!-- show handbook unless we are in a very long section -->
{{ if eq $s.Title "Handbook" }} {{ if lt (len $p.CurrentSection.Pages) 7
}} {{ $showPage = true }} {{ end }}
<!-- always show handbook if we are on the frontpage -->
{{ if eq $csid "welcome" }} {{ $showPage = true }} {{ end }} {{ end }} {{
if $showPage }}
< a
class="td-sidebar-link td-sidebar-link__page {{ if $activePage }} active{{ end }}"
id="{{ $mid }}"
href="{{ .RelPermalink }}"
>
{{.LinkTitle }}
< / a >
{{ end }} {{/* end minikube hack */}} {{ else }} {{ template
"section-tree-nav-section" (dict "page" $p "section" .) }} {{ end }} {{
end }}
< / li >
2020-03-31 02:31:17 +00:00
< / ul >
2021-08-02 16:53:52 +00:00
< / ul >
{{ end }} {{ end }}