1 min read

Sidebar Ordering

Place a _meta.json file in any content directory to control the order pages appear in the sidebar tree.

Example

{
  "title": "API Reference",
  "pages": [
    "index",
    "--- Core",
    "dosource",
    "buildpagetree",
    "---",
    "--- Navigation",
    "getbreadcrumbs",
    "getpageneighbours"
  ],
  "defaultOpen": true,
  "icon": "📖"
}

Rules

  • Strings starting with "--- " become labelled separators
  • "---" alone becomes an unlabelled divider
  • Pages not listed in pages are appended at the end in alphabetical order
  • defaultOpen controls whether the folder starts expanded in the sidebar
  • icon adds an emoji or string icon to the folder

Static generation

Use generateStaticParams to pre-render all docs pages at build time:

export async function generateStaticParams() {
  return (await source.getPages()).map((page) => ({
    slug: page.slugs.filter(Boolean),
  }));
}

This works with Next.js App Router's [[...slug]] catch-all route.

Hot reload

During development, call source.invalidate() when content files change to clear all cached data:

source.invalidate();

This forces the next getPages(), getPageTree(), getPage(), or search query to re-read from disk.