Closed lcdunne closed 1 month ago
It seems like you need to use multiple sidebars. Create one for the docs and one for the api. Leave the api as auto-generated if you want. Then link to an intro page for each in the nav in the docusarus.config.
https://docusaurus.io/docs/sidebar
tutorialSidebar: [
//pretend I am some stuff added
],
apiSidebar: [
{
type: 'autogenerated',
dirName: "api" //assuming it's in your docs folder
},
],
navbar: {
//some stuff here
},
items: [
{
type: 'docSidebar',
sidebarId: 'tutorialSidebar',
position: 'left',
label: 'Docs',
},
{
to: '/docs/api/',
sidebarId: 'apiSidebar',
position: 'left',
label: 'API Reference'
}
],
},
This issue describes the problem well. My case was more or less the same - I wanted to separate my docusaurus site into "Docs" and "API" sections, with separate nav items at the top.
When viewing the Docs nav, I wanted JUST my documentation defined in the
./docs
folder to show in the sidebar, and when viewing the API nav, I wanted JUST the OAS to show in the sidebar. I was able to get most of the way, but because the OAS goes in the docs folder (in my case under./docs/api/
), there is the additionalapi
item in the sidebar when viewing the Docs nav. Selecting the API nav from the top shows the correct sidebar though.The demo repo seems to be exactly what I want to accomplish, only there is this problem when auto-generating the sidebar when the api spec is generated inside the docs folder. I think it would be useful to include some information on how to deal with that in the documentation as I couldn't see anything. I was expecting to be able to use the auto-generated docs, but currently the only way to resolve it is to manually define the sidebar so that it does not include the openapi docs.
Maybe this is a bug that occurred with the recent update to support the latest docusaurus?