feat(theme): support disabling aside globally (#1925)

Co-authored-by: Divyansh Singh <40380293+brc-dd@users.noreply.github.com>
pull/1930/head
dominikcz 2 years ago committed by GitHub
parent 4a19dde97b
commit dd0c4c698c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -157,6 +157,13 @@ export type SidebarItem = {
} }
``` ```
## aside
- Type: `boolean`
- Default: `true`
Setting this value to `false` prevents rendering of aside container.
## outline ## outline
- Type: `number | [number, number] | 'deep' | false` - Type: `number | [number, number] | 'deep' | false`

@ -50,9 +50,10 @@ export function useSidebar() {
}) })
const hasAside = computed(() => { const hasAside = computed(() => {
return ( if (frontmatter.value.layout === 'home') return false
frontmatter.value.layout !== 'home' && frontmatter.value.aside !== 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) const isSidebarEnabled = computed(() => hasSidebar.value && is960.value)

@ -47,6 +47,13 @@ export namespace DefaultTheme {
*/ */
sidebar?: Sidebar 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 * Info for the edit link. If it's undefined, the edit link feature will
* be disabled. * be disabled.

Loading…
Cancel
Save