{{- $context := .context -}} {{- $disableSidebar := .disableSidebar | default false -}} {{- $displayPlaceholder := .displayPlaceholder | default false -}} {{- $sidebarClass := cond $disableSidebar (cond $displayPlaceholder "md:hx-hidden xl:hx-block" "md:hx-hidden") "md:hx-sticky" -}} {{- $navRoot := cond (eq site.Home.Type "docs") site.Home $context.FirstSection -}} {{- $pageURL := $context.RelPermalink -}} {{- $data := slice -}} {{- $dataMobile := slice -}} {{- if (eq site.Params.page.sidebar.source "data") -}} {{ $data = partialCached "components/sidebar/get-section-data" $context $context.Section }} {{- $dataMobile = $data -}} {{- else -}} {{- $data = (partialCached "components/sidebar/generate-section-data" $navRoot $navRoot) | unmarshal -}} {{- $dataMobile = (partialCached "components/sidebar/generate-section-data" site.Home site.Home) | unmarshal -}} {{- end -}} {{- $shouldCache := site.Params.page.sidebar.cache | default false -}} {{/* EXPERIMENTAL */}} {{- if .context.Params.sidebar.hide -}} {{- $disableSidebar = true -}} {{- $displayPlaceholder = true -}} {{- end -}}
{{- define "partials/components/sidebar/mobile-search" -}}
{{- partialCached "search.html" . -}}
{{- end -}} {{- define "partials/components/sidebar/switches" -}} {{- $context := .context -}} {{- $disableSidebar := .disableSidebar -}} {{/* Hide theme switch when sidebar is disabled */}} {{ $switchesClass := cond $disableSidebar "md:hx-hidden" "" -}} {{ $displayThemeToggle := (site.Params.theme.displayToggle | default true) -}} {{ if or site.IsMultiLingual $displayThemeToggle }}
{{- with site.IsMultiLingual -}} {{- partial "language-switch" (dict "context" $context "grow" true) -}} {{- with $displayThemeToggle }}{{ partial "theme-toggle" (dict "hideLabel" true) }}{{ end -}} {{- else -}} {{- with $displayThemeToggle -}}
{{ partial "theme-toggle" }}
{{- end -}} {{- end -}}
{{- end -}} {{- end -}}