Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Generating new sidebars and docs sections #11

Open
jq-11 opened this issue Nov 14, 2024 · 1 comment
Open

Generating new sidebars and docs sections #11

jq-11 opened this issue Nov 14, 2024 · 1 comment

Comments

@jq-11
Copy link

jq-11 commented Nov 14, 2024

Summary

How to generate new documentations headers with custom and or automated sidebars

Create a new folder with content

./Testing 
    intro.md

copy the sidebar.js file at the root, rename it appropriatly,

sidebars.js --> testSidebars.js

update the sidebar Id appropriatly (line 18), remove line 21 it is not required

  testSidebar: [{type: 'autogenerated', dirName: '.'}],

Go to your docusaur config

  1. add plugins as follows
  plugins: [
    [
      '@docusaurus/plugin-content-docs',
      {
        id: 'test',
        path: 'Testing',
        routeBasePath: 'Testing',
        sidebarPath: require.resolve('./testSidebars.js'),
      },
    ],
  ],
  1. under themeConfig > navbar add the following to the items array
{to: '/Testing/intro', label: 'Test', position: 'left'},
@jq-11
Copy link
Author

jq-11 commented Nov 14, 2024

Importing components globally

src > theme

create a MDXComponents.ts or js use the folllowing as reference (this is a ts file)

import type {ComponentType} from 'react';
import MDXComponents from '@theme-original/MDXComponents';
import H5P from '@site/src/components/H5P';
import H5PLink from '@site/src/components/H5PLink';
import Tabs from '@theme/Tabs';
import TabItem from '@theme/TabItem';

const components: typeof MDXComponents & {
  H5P: ComponentType<any>;
  H5PLink: ComponentType<any>;
} = {
  ...MDXComponents,
  H5P,
  H5PLink,
  Tabs,
  TabItem,
};

export default components;

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant