How to use in single website with both landing page and /docs route.?
I have this site grida.co - https://github.com/gridaco/grida.co Which has both landing page and docs site (currently not using nextra)
And I'm wondering if i can spcecify nextra to only interpret specific directory - /docs and convert them to a docs site. not all of the entire repository.
Thanks!
I want this too. Will this be available in nextra v2.0?
I tested some work-arounds in NextJS Docs.
- Add a
/pages/docsfolder Just add this folder and Nextra will handle all.mdxfile. The problem with this method is that all pages will show always show a top level "docs" folder. - With basePath
Here in https://nextjs.org/docs/migrating/incremental-adoption, there's an option to host a NextJS as subpath. Notice that you need to pass the
nextConfigintowithNextra. Problem here is I don't know and I didn't test if a rewrite is needed.
The repo I used to test is here https://github.com/PabloLION/test-nextra
Use https://github.com/shuding/nextra/tree/core/examples/swr-site as an example
The problem with this method is that all pages will show always show a top level "docs" folder.
We can move "docs" from sidebar to NavBar by creating _meta.json outside "docs" folder with contents.
{
"docs": {
"title": "Docs",
"type": "page"
}
}
Before:
After:
Ref: https://nextra.site/docs/docs-theme/page-configuration#navbar-items
If we don't want "docs" at all, we can hide it: https://nextra.site/docs/docs-theme/page-configuration#hidden-routes