diff --git a/docs/content/docs/guide/configuration.md b/docs/content/docs/guide/configuration.md index 05bbef4..6116e10 100644 --- a/docs/content/docs/guide/configuration.md +++ b/docs/content/docs/guide/configuration.md @@ -164,6 +164,21 @@ menu: weight: 3 ``` +### Hiding + +Hiding the sidebar can be done using front matter: + +```yaml {filename="content/docs/guide/configuration.md"} +--- +title: Configuration +sidebar: + hide: true +--- +``` + +This will hide the main sidebar from the page, freeing up space for the main content of the page. + + ## Right Sidebar ### Table of Contents diff --git a/layouts/_partials/sidebar.html b/layouts/_partials/sidebar.html index e5c69ae..52928cd 100644 --- a/layouts/_partials/sidebar.html +++ b/layouts/_partials/sidebar.html @@ -3,17 +3,22 @@ {{- $disableSidebar := .disableSidebar | default false -}} {{- $displayPlaceholder := .displayPlaceholder | default false -}} -{{- $sidebarClass := cond $disableSidebar (cond $displayPlaceholder "hx:md:hidden hx:xl:block" "hx:md:hidden") "hx:md:sticky" -}} - {{- $navRoot := cond (eq site.Home.Type "docs") site.Home $context.FirstSection -}} {{- $pageURL := $context.RelPermalink -}} -{{/* EXPERIMENTAL */}} {{- if .context.Params.sidebar.hide -}} {{- $disableSidebar = true -}} - {{- $displayPlaceholder = true -}} + {{- $displayPlaceholder = false -}} {{- end -}} +{{- $sidebarClass := "hx:md:sticky" -}} +{{- if $disableSidebar -}} + {{- if $displayPlaceholder -}} + {{- $sidebarClass = "hx:md:hidden hx:xl:block" -}} + {{- else -}} + {{- $sidebarClass = "hx:md:hidden" -}} + {{- end -}} +{{- end -}}