简体   繁体   中英

Make sidebar not collapsable and always expanded in docusaurus V2 classic preset

If you use classic template when creating the doc, you'll get a sidebar like this:

(Docusaurus v2)

How can I keep using this preset and have a sidebar always expanded like this :

(ComponentKit)

Sidebar collapsing is a theme configuration attribute. You can modify this:

// docusaurus.config.js
module.exports = {
  // ...
  themeConfig: {
    sidebarCollapsible: false,
    // ...
  },
};

The sidebarCollapsible option has now moved to the docs section of the presets config:

const config = {
  presets: [
    [
      "classic",
      /** @type {import('@docusaurus/preset-classic').Options} */
      ({
        docs: {
          sidebarPath: require.resolve("./sidebars.js"),
          sidebarCollapsible: false,
        },
       ...
       )
     ]
   ]
}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM