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

Feature: (docusaurus) autogenerated sidebars #217

Merged
merged 3 commits into from
May 5, 2021

Conversation

tgreyuk
Copy link
Member

@tgreyuk tgreyuk commented May 2, 2021

Motivation

With the introduction of autogenerated sidebars in Docusaurus 2.0.0-alpha73 (facebook/docusaurus#4582) manual sidebar generation is no longer required (or desired):

Default usage:

// sidebars.js
module.exports = {
  someSidebar: [
    {
      type: 'autogenerated',
      dirName: '.', // '.' means the docs folder
    },
  ],
};

Slice usage:

// sidebars.js
module.exports = {
  someSidebar: {
    'Category 1': ['doc1', 'doc2', 'doc3'],
    'API': [
      {
        type: 'autogenerated',
        dirName: 'api', // 'api' is the 'out' directory
      },
    ],
  },
};

Additional options (not relevant if using a sidebar slice):

  • sidebar.categoryLabel The sidebar parent category label.
  • sidebar.position The position of the sidebar in the tree.

Other notes:

  • Readme and globals/TOC pages are positioned at the top with frontmatter.
  • _category_.yml are generated in each folder to control category labels and position with pre-defined values.

Related:

@tgreyuk tgreyuk changed the title Feature/ (docusaurus) autogenerated sidebars Feature: (docusaurus) autogenerated sidebars May 2, 2021
@tgreyuk tgreyuk force-pushed the feature/docusaurus-autogenerated-sidebars branch from 45ff555 to 65e5b56 Compare May 2, 2021 16:29
@tgreyuk tgreyuk force-pushed the feature/docusaurus-autogenerated-sidebars branch from 65e5b56 to a2002ca Compare May 4, 2021 22:02
@tgreyuk tgreyuk merged commit e8c474f into master May 5, 2021
@tgreyuk tgreyuk deleted the feature/docusaurus-autogenerated-sidebars branch May 5, 2021 20:45
@krailler
Copy link

How can I use the manual sidebar? I don't like the autogenerated sidebar

@tgreyuk
Copy link
Member Author

tgreyuk commented Jun 28, 2021

The typedoc sidebar will be autogenerated but you can manually control the rest of the sidebar. See point 2 in https://github.com/tgreyuk/typedoc-plugin-markdown/tree/master/packages/docusaurus-plugin-typedoc#sidebar.

@krailler
Copy link

The typedoc sidebar will be autogenerated but you can manually control the rest of the sidebar. See point 2 in https://github.com/tgreyuk/typedoc-plugin-markdown/tree/master/packages/docusaurus-plugin-typedoc#sidebar.

But typedoc-sidebar.js doesn't contains the file list...

@tgreyuk
Copy link
Member Author

tgreyuk commented Jun 28, 2021

No - because it is generated by the file system and the end result 'should' be the same.

What is your use-case for needing the manual sidebar? Is there a particular issue you are having?

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

Successfully merging this pull request may close these issues.

None yet

2 participants