docusaurus-openapi
docusaurus-openapi copied to clipboard
Support for custom items inside existing navigation sidebar
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.
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?
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"
}
],
},
}
]
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
Thank you so much. I couldn't find anything about it in the examples and issue so I assumed it wasn't available.
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
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: https://github.com/cloud-annotations/docusaurus-openapi/pull/192
Then I will approve & merge which will automatically release a new version of the plugin
@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.
Ah I see, we don’t have a way to add links. Happy to accept a PR that adds the feature though