diff --git a/docs/config/theme-configs.md b/docs/config/theme-configs.md index 4c90d12f..d8ffc45c 100644 --- a/docs/config/theme-configs.md +++ b/docs/config/theme-configs.md @@ -157,6 +157,13 @@ export type SidebarItem = { } ``` +## aside + +- Type: `boolean` +- Default: `true` + +Setting this value to `false` prevents rendering of aside container. + ## outline - Type: `number | [number, number] | 'deep' | false` @@ -300,7 +307,7 @@ An option to support searching your docs site using [Algolia DocSearch](https:// ```ts export interface AlgoliaSearchOptions extends DocSearchProps { - locales?: Record> + locales?: Record> } ``` diff --git a/src/client/theme-default/composables/sidebar.ts b/src/client/theme-default/composables/sidebar.ts index 6e90e4ae..429a4d7c 100644 --- a/src/client/theme-default/composables/sidebar.ts +++ b/src/client/theme-default/composables/sidebar.ts @@ -50,9 +50,10 @@ export function useSidebar() { }) const hasAside = computed(() => { - return ( - frontmatter.value.layout !== 'home' && frontmatter.value.aside !== false - ) + if (frontmatter.value.layout === 'home') return false + if (frontmatter.value.aside != null) return !!frontmatter.value.aside + if (theme.value.aside === false) return false + return true }) const isSidebarEnabled = computed(() => hasSidebar.value && is960.value) diff --git a/types/default-theme.d.ts b/types/default-theme.d.ts index 02bb8b9c..ea6635df 100644 --- a/types/default-theme.d.ts +++ b/types/default-theme.d.ts @@ -47,6 +47,13 @@ export namespace DefaultTheme { */ sidebar?: Sidebar + /** + * Set to `false` to prevent rendering of aside container. + * + * @default true + */ + aside?: boolean + /** * Info for the edit link. If it's undefined, the edit link feature will * be disabled.