Configuration

API reference + Docs#

A common requirement for expansive documentation sites is having both guides and an API reference.

API reference is a lot more technical and usually isn't very helpful for beginners, but massively helpful if you know the library already and want to fact check something.

The guides is almost the opposite: It's very friendly for beginners, but lacks the completeness of an API reference.

Adding the two sections to your project#

The recommended way to add an API reference next to your guides is to use tabs.

Tabs is a configuration option for a Guider site that allows for easy switching between two contexts.

Adding the pages to sub-directories#

First, you have to make sure that your pages are divided in sub-directories. Like so:

  • /pages/guides All your MDX files or pages for your guides
  • /pages/api All your MDX files or pages for your API reference

Configuring your tabs#

Your site configuration needs to be split into two directory() instances and need to have the configured tabs. Like so:

theme.config.tsx
import { directories, link, defineTheme } from "@neato/guider/theme"
 
export default defineTheme({
  tabs: [
    link("Guides", "/guides"),
    link("API reference", "/api"),
  ]
  directories: [
    directory('guides', {
      sidebar: [
        // your sidebar items
      ],
    }),
    directory('api', {
      sidebar: [
        // your sidebar items
      ],
    })
  ]
})

Creating meta files#

To make your pages tied to your directory() instances (and tabs), you'll need to make two meta files for each folder.

/pages/guides/_meta.json
{
  "directory": "guides"
}
/pages/api/_meta.json
{
  "directory": "api"
}