0

I am trying to rename the default docs path to home so that all the "documentation" files will be found under the home directory like home/doc1. So, I followed this guide: https://docusaurus.io/docs/docs-multi-instance and changed up my docusaurus.config.js file like so:

module.exports = {
  title: 'Neuro Guide',
  tagline: 'The tagline of my site',
  url: 'https://neuro-guide.vercel.app',
  baseUrl: '/',
  favicon: 'img/favicon.ico',
  organizationName: 'aakhilv', // Usually your GitHub org/user name.
  projectName: 'neuro-guide', // Usually your repo name.
  themeConfig: {
    navbar: {
      title: 'Neuro Guide',
      logo: {
        alt: 'Logo',
        src: 'img/logo.svg',
      },
      links: [{
        to: 'home/doc1',
        activeBasePath: 'home',
        label: 'Home',
        position: 'left',
      }, ],
    },
    footer: {
      style: 'dark',
      copyright: `© ${new Date().getFullYear()} aakhilv`,
    },
  },
  plugins: [
    [
      '@docusaurus/plugin-content-docs',
      {
        id: 'home',
        path: 'home',
        routeBasePath: 'home',
        docs: {
          sidebarPath: require.resolve('./sidebars.js'),
        },
        theme: {
          customCss: require.resolve('./src/css/custom.css'),
        },
      },
    ],
  ],
};

However, I keep getting this error:

Anyone know how I could fix it?

aakhilv
  • 123
  • 2
  • 11

2 Answers2

3

I think the error is because you need at least one theme activated. If you use the classic preset (https://docusaurus.io/docs/presets#docusauruspreset-classic) then you just need to set this config:

presets: [
  [
    '@docusaurus/preset-classic',
    {
      docs: {
        path: 'home',
        routeBasePath: 'home',
      },
    },
  ],
],
David Radcliffe
  • 1,481
  • 10
  • 12
0

After adding the below code

presets: [
  [
    '@docusaurus/preset-classic',
    {
      docs: {
         path: './docs', //This should be the path to your docs folder
         routeBasePath: 'home'  //This should be the word that you want to set
       },
    },
  ],
],

Remove the node_modules and package-lock.json And again do a npm install if it does not work for you directly