I'm using Docusaurus 2.0.0-rc.1 and trying to add hideable: true
and autoCollapseCategories: true
options in docusaurus.config.js according to https://docusaurus.io/docs/sidebar#hideable-sidebar, but I've received an error during build:
> docusaurus build
[INFO] [en] Creating an optimized production build...
[ERROR] Unable to build website for locale en.
[ERROR] ValidationError: "docs.sidebar" is not allowed
My sidebars.js (autogenerated sidebar):
/** @type {import('@docusaurus/plugin-content-docs').SidebarsConfig} */
const sidebars = {
DocSidebar: [{type: 'autogenerated', dirName: '.'}],
};
module.exports = sidebars;
My docusaurus.config.js:
// @ts-check
// Note: type annotations allow type checking and IDEs autocompletion
const lightCodeTheme = require('prism-react-renderer/themes/github');
const darkCodeTheme = require('prism-react-renderer/themes/dracula');
/** @type {import('@docusaurus/types').Config} */
const config = {
title: 'Test portal',
tagline: 'Test company',
url: 'https://test.com',
baseUrl: '/',
onBrokenLinks: 'ignore',
onBrokenMarkdownLinks: 'warn',
favicon: 'img/favicon.ico',
organizationName: 'Test.com', // Usually your GitHub org/user name.
projectName: 'test-repo', // Usually your repo name.
presets: [
[
'classic',
/** @type {import('@docusaurus/preset-classic').Options} */
({
docs: {
lastVersion: 'current',
versions: {
current: {
label: '1.1.0',
path: '1.1.0',
badge: true,
},
},
sidebarPath: require.resolve('./sidebars.js'),
},
blog: false,
theme: {
customCss: require.resolve('./src/css/custom.css'),
},
}),
],
],
themeConfig:
/** @type {import('@docusaurus/preset-classic').ThemeConfig} */
({
docs: {
sidebar: {
hideable: true,
autoCollapseCategories: true,
},
},
navbar: {
title: 'Docs portal',
logo: {
alt: 'Company Logo',
src: 'img/logo.png',
},
items: [
{
type: 'doc',
docId: 'intro',
position: 'left',
label: 'Product docs',
},
{
type: 'docsVersionDropdown',
position: 'right',
dropdownItemsAfter: [{to: '/versions', label: 'All versions'}],
dropdownActiveClassDisabled: true,
},
{
href: 'https://test.com',
label: 'Test Company',
position: 'right',
},
],
},
footer: {
style: 'dark',
copyright: `Copyright © ${new Date().getFullYear()} Test Company Built with Docusaurus.`,
},
prism: {
theme: lightCodeTheme,
darkTheme: darkCodeTheme,
},
}),
};
module.exports = config;