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

Support for custom items inside existing navigation sidebar #217

Open
searchableguy opened this issue Sep 27, 2022 · 8 comments
Open

Support for custom items inside existing navigation sidebar #217

searchableguy opened this issue Sep 27, 2022 · 8 comments

Comments

@searchableguy
Copy link

searchableguy commented Sep 27, 2022

Can you have existing navigation items on the API page?

I looked through the existing issues and I found some talk about nesting support for multiple API files but nothing about using it with existing navigation items.

Is it possible to add custom sidebar generator?

I will be happy to contribute if it's not too difficult to allow.

@bourdakos1
Copy link
Member

We don’t plan on adding a double sidebar like this. We support multiple api files and nesting through collapsing sections in a single sidebar. If you want a double sidebar I would recommend using redocusaurus. Is there a reason you were looking to use this plugin instead?

@searchableguy
Copy link
Author

searchableguy commented Sep 29, 2022

I apologise for not being clear. I'm not asking for double sidebar and embedding generated open API pages inside existing docs.

I want to add custom items to the sidebar aside from the generated API category.

docusaurus for example allow you to customize sidebar with generated elements using sidebar.js

const sidebar = [
    {
      label: "API",
      type: "category",
      items: [
        {
          type: "autogenerated",
          dirName: "openapi", // open API generated sidebar items.
        },
        { 
          type: "link",  // custom ones user want to display.
          href: "example.com"
        }
      ],
    },
   }
 ]

@bourdakos1
Copy link
Member

Ooh I see, yes we support that. It’s not well documented at the moment, but I can provide some more information on how to do that shortly

@searchableguy searchableguy changed the title Support for nesting inside existing navigation sidebar Support for custom items inside existing navigation sidebar Sep 29, 2022
@searchableguy
Copy link
Author

Thank you so much. I couldn't find anything about it in the examples and issue so I assumed it wasn't available.

@bourdakos1
Copy link
Member

Take a look at this PR #193 for some info on how to structure things to customize the sidebar. There's also an example in the demo with custom md pages added

@bourdakos1
Copy link
Member

Oh sorry looks like we haven't released a new version since that PR. If you want, you can follow the doc here: https://github.com/cloud-annotations/docusaurus-openapi/tree/main/scripts

and make a PR similar to this one: #192

Then I will approve & merge which will automatically release a new version of the plugin

@searchableguy
Copy link
Author

searchableguy commented Oct 5, 2022

@bourdakos1 I checked the example.

I might be missing it but it does not show to use a custom sidebar.js for the API page. Could you clarify this for me?

I only see support for using markdown pages and have them appear which is great but if someone wants to use their existing sidebar.js, I don't see an option in the example especially relevant if you want to add links.

@bourdakos1
Copy link
Member

Ah I see, we don’t have a way to add links. Happy to accept a PR that adds the feature though

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

2 participants