mirror of
https://github.com/facebook/docusaurus.git
synced 2025-06-15 17:22:35 +02:00
fix(v2): improve dx sidebar config, ability to have no sidebars file (#4775)
* Improve sidebar config * Edit message * fix some little issues in the way undefined/false sidebars are handled * remove old error message as it has been moved to a better place Co-authored-by: Nam Hoang Le <nam.hoang.le@mgm-tp.com> Co-authored-by: slorber <lorber.sebastien@gmail.com>
This commit is contained in:
parent
e85ec1ab12
commit
1ab8aa0af8
10 changed files with 235 additions and 129 deletions
|
@ -21,12 +21,11 @@ import {
|
|||
DisabledNumberPrefixParser,
|
||||
} from './numberPrefix';
|
||||
|
||||
export const DEFAULT_OPTIONS: Omit<PluginOptions, 'id'> = {
|
||||
export const DEFAULT_OPTIONS: Omit<PluginOptions, 'id' | 'sidebarPath'> = {
|
||||
path: 'docs', // Path to data on filesystem, relative to site dir.
|
||||
routeBasePath: 'docs', // URL Route.
|
||||
homePageId: undefined, // TODO remove soon, deprecated
|
||||
include: ['**/*.{md,mdx}'], // Extensions to include.
|
||||
sidebarPath: 'sidebars.json', // Path to the sidebars configuration file
|
||||
sidebarItemsGenerator: DefaultSidebarItemsGenerator,
|
||||
numberPrefixParser: DefaultNumberPrefixParser,
|
||||
docLayoutComponent: '@theme/DocPage',
|
||||
|
@ -67,7 +66,10 @@ export const OptionsSchema = Joi.object({
|
|||
.default(DEFAULT_OPTIONS.routeBasePath),
|
||||
homePageId: Joi.string().optional(),
|
||||
include: Joi.array().items(Joi.string()).default(DEFAULT_OPTIONS.include),
|
||||
sidebarPath: Joi.string().allow('').default(DEFAULT_OPTIONS.sidebarPath),
|
||||
sidebarPath: Joi.alternatives().try(
|
||||
Joi.boolean().invalid(true),
|
||||
Joi.string(),
|
||||
),
|
||||
sidebarItemsGenerator: Joi.function().default(
|
||||
() => DEFAULT_OPTIONS.sidebarItemsGenerator,
|
||||
),
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue