2020-04-04 23:25:53 +00:00
<!-- note, this is only used in /docs -->
2020-03-31 02:37:37 +00:00
{{/* minikube hack: temporarily forked from docsy/layouts/partials/sidebar-tree.html for hugo v0.69 compatibility */}}
2020-03-31 02:36:12 +00:00
2020-03-31 02:37:37 +00:00
{{/* We cache this partial for bigger sites and set the active class client side. */}}
{{ $shouldDelayActive := ge (len .Site.Pages) 2000 }}
2020-03-31 02:31:17 +00:00
< div id = "td-sidebar-menu" class = "td-sidebar__inner{{ if $shouldDelayActive }} d-none{{ end }}" >
{{ if not .Site.Params.ui.sidebar_search_disable }}
< form class = "td-sidebar__search d-flex align-items-center" >
{{ partial "search-input.html" . }}
< 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 >
< / form >
{{ end }}
< nav class = "collapse td-sidebar-nav pt-2 pl-4" id = "td-section-nav" >
{{ if (gt (len .Site.Home.Translations) 0) }}
< div class = "nav-item dropdown d-block d-lg-none" >
{{ partial "navbar-lang-selector.html" . }}
< / div >
{{ end }}
{{ template "section-tree-nav-section" (dict "page" . "section" .FirstSection "delayActive" $shouldDelayActive) }}
< / nav >
< / div >
2020-04-04 23:25:53 +00:00
<!-- this gets called for every section -->
2020-03-31 02:31:17 +00:00
{{ define "section-tree-nav-section" }}
{{ $s := .section }}
{{ $p := .page }}
{{ $shouldDelayActive := .delayActive }}
2020-04-04 23:25:53 +00:00
{{ $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 -->
2020-03-31 02:31:17 +00:00
{{/* end minikube hack */}}
{{ $sid := $s.RelPermalink | anchorize }}
2020-04-04 23:25:53 +00:00
{{ 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" > {{ $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 }}
<!-- always show pages in the current section -->
{{ if $activeSection }}
{{ $showPage = true }}
{{ $activePage := eq . $p }}
{{ end }}
2020-04-06 23:25:56 +00:00
<!-- show handbook unless we are in a very long section -->
2020-04-04 23:25:53 +00:00
{{ if eq $s.Title "Handbook" }}
2020-04-06 23:25:56 +00:00
{{ if lt (len $p.CurrentSection.Pages) 7 }}
2020-04-04 23:25:53 +00:00
{{ $showPage = true }}
{{ end }}
2020-04-06 23:25:56 +00:00
<!-- always show handbook if we are on the frontpage -->
{{ if eq $csid "welcome" }}
{{ $showPage = true }}
{{ end }}
2020-04-04 23:25:53 +00:00
{{ end }}
{{ if $showPage }}
2020-03-31 02:31:17 +00:00
< a class = "td-sidebar-link td-sidebar-link__page {{ if $activePage }} active{{ end }}" id = "{{ $mid }}" href = "{{ .RelPermalink }}" > {{ .LinkTitle }}< / a >
2020-04-04 23:25:53 +00:00
{{ end }}
{{/* end minikube hack */}}
{{ else }}
{{ template "section-tree-nav-section" (dict "page" $p "section" .) }}
2020-03-31 02:31:17 +00:00
{{ end }}
2020-04-04 23:25:53 +00:00
{{ end }}
< / li >
< / ul >
2020-03-31 02:31:17 +00:00
< / ul >
2020-04-04 23:25:53 +00:00
{{ end }}
2020-03-31 02:31:17 +00:00
{{ end }}