diff --git a/layouts/partials/sidebar.html b/layouts/partials/sidebar.html
index 9a769e0..742a6e4 100644
--- a/layouts/partials/sidebar.html
+++ b/layouts/partials/sidebar.html
@@ -33,22 +33,8 @@
{{ end -}}
- {{/* Hide theme switch when sidebar is disabled */}}
- {{ $switchesClass := cond $disableSidebar "md: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 -}}
+ {{ partial "sidebar/switches" (dict "context" $context "disableSidebar" $disableSidebar) }}
{{- define "sidebar-main" -}}
@@ -119,3 +105,24 @@
{{ end -}}
{{- end -}}
+
+{{- define "partials/sidebar/switches" -}}
+ {{- $context := .context -}}
+ {{- $disableSidebar := .disableSidebar -}}
+ {{/* Hide theme switch when sidebar is disabled */}}
+ {{ $switchesClass := cond $disableSidebar "md: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 -}}