nextra
nextra copied to clipboard
The top level `docs` button opens the first `proper page` instead of the first `actual page`
I am using Nextra at work, and first I just want to thank you for such an amazing open sourced product. I want to report a bug however.
Expected behaviour:
- The default
docsbutton should redirect to the first page in the docs, regardless of whether it is aproper pageor afolder with an index page.
Actual behaviour:
- Check out this website at https://docs.availproject.org/. When you click on the
docsbutton on the top-right, it redirects to theAvail DApage, instead of the page associated with the folderintroduction-to-avail.
@dimaMachina tagging for visibility.
Having the same issue, there's a workaround that can be applied in theme.config.tsx though:
import {Navbar} from 'nextra-theme-docs';
// ...
navbar: {
component: function CustomNavbar({
items,
...rest
}: ComponentProps<typeof Navbar>) {
// https://github.com/shuding/nextra/issues/2836
const props = {
items: items.map((item) => {
if (item.route === '/docs') {
return {
...item,
firstChildRoute: '/docs'
};
} else {
return item;
}
}),
...rest
};
return <Navbar {...props} />;
}
},