docusaurus-openapi
docusaurus-openapi copied to clipboard
Navigation does not work in 'api' only mode
##Summary I want to use docusaurus-openapi to generate a docs only website from a swagger file, but navigation does not work.
Steps to reproduce
Bootstrap a new project with npx create-docusaurus-openapi my-website
Remove the src/pages/index.js file.
Change the preset block in docusaurus.config.js to the code below:
presets: [
[
"docusaurus-preset-openapi",
/** @type {import('docusaurus-preset-openapi').Options} */
({
api: {
routeBasePath: '/',
},
blog: false,
pages: false,
docs: false,
debug: false,
theme: {
customCss: require.resolve("./src/css/custom.css"),
},
}),
],
]
Observation
Clicking on links in the sidebar changes the url routes in the browser address bar but not the content on the page.
Root cause
I noticed that in .docusaurus/routes,js, we have the code below:
routes: [
{
path: '',
component: ComponentCreator('','1f6'),
exact: true,
'sidebar': "openapi-sidebar-default"
},
If the above is changed to
routes: [
{
path: '/',
component: ComponentCreator('','1f6'),
exact: true,
'sidebar': "openapi-sidebar-default"
},
Then the navigation works again.
From my short investigation the root cause seems to be here.
Thanks.
Thanks @olufotebig, I will try to reproduce