Skip to content

Navigation and links

Content files determine which routes exist. Navigation determines where readers find those routes. Add a page under content/, then link to its public route in docskit.config.ts.

Content routes

FileRoute before deployment and version prefixes
content/index.md/docs/
content/installation.md/docs/installation/
content/guides/index.md/docs/guides/
content/guides/setup.md/docs/guides/setup/
content/api-references/index.md/api-references/
content/api-references/client.md/api-references/client/

Files such as guides.md and guides/index.md produce the same route. Keep one of them; duplicate routes fail the build.

Each group has a label and an items array. An item is either a link or another group. Add the following navigation field to your config:

TypeScript
navigation: [
  {
    label: "Getting started",
    items: [
      { label: "Overview", href: "/docs/" },
      { label: "Installation", href: "/docs/installation/" },
    ],
  },
  {
    label: "Guides",
    items: [
      {
        label: "Integrations",
        items: [
          { label: "Client", href: "/docs/integrations/client/" },
        ],
      },
    ],
  },
],

Create the matching content files for every link. Previous and next page links follow the flattened sidebar order within guides or API references.

Use repository for the GitHub link at the top of the site:

TypeScript
repository: "https://github.com/pinanek/docskit",

Use links to replace the default navbar links:

TypeScript
links: [
  { label: "Documentation", href: "/docs/" },
  { label: "API reference", href: "/api-references/" },
],

Without an explicit links array, the navbar includes Documentation and adds API references when apiNavigation has entries. The repository link is configured separately from this array. See API documentation to create API pages and their sidebar.

Use a filename when linking between source pages:

Markdown
Read [installation](../getting-started/installation.md).
Read [deployment settings](../publishing/deployment.md#deploy-under-a-subpath).

Docskit resolves Markdown file links into public page URLs and keeps their query strings and fragments. A bare fragment such as #examples stays on the page. External links keep their original URL.

For assets, use public URLs with their extensions, such as /images/example.svg. The file should be stored at public/images/example.svg.

Deployment and version prefixes

Keep config links rooted at /docs/ or /api-references/. A site deployed under /project/ adds that prefix. A selected version also adds its own route prefix. For example, Next's guide overview becomes /project/next/docs/ in production.

Use the public Link component in custom React pages so those pages follow the same navigation behavior. The pages guide shows a complete example.