category.json

Overview

The _category_.json file is a configuration file used primarily for organizing and categorizing content within a documentation or knowledge base system, such as those generated by tools like Docusaurus or similar static site generators. Its main purpose is to define metadata for a category or folder, including how it is labeled, ordered (positioned), and linked within the navigation structure.

This file does not contain executable code but rather descriptive data that influences how the documentation system presents and navigates grouped content. Specifically, it helps generate index pages and navigation menus that organize related documents under a named category.


File Structure and Fields

The file is structured as a JSON object with the following key properties:

Property

Type

Description

label

string

The display name of the category as it appears in navigation menus or headings.

position

integer

Controls the order of this category relative to others; lower numbers appear first.

link

object

Defines how the category links to content, including the type of link and a descriptive summary.

Detailed Explanation of Fields


Usage Example

Suppose you have a documentation folder named MCP containing several markdown files about the MCP system. To create a nicely organized navigation category with a summary page, place this _category_.json file inside that folder:

/docs
  /MCP
    _category_.json
    intro.md
    usage.md
    reference.md

This configuration will produce a sidebar entry labeled MCP appearing at position 40 in the menu, linking to a generated index page that shows the description and lists the files contained.


Important Implementation Details


Interaction with Other Files and System Components


Visual Diagram

This file defines a data structure rather than code classes or functions. A flowchart illustrating how the file's fields influence navigation generation is appropriate:

flowchart TD
    A[_category_.json file]
    A --> B[label: Category display name]
    A --> C[position: Category order]
    A --> D[link object]
    D --> D1[type: link type]
    D --> D2[description: summary text]
    
    B --> E[Displayed in Sidebar]
    C --> E
    D1 --> F{Link Type}
    F -->|generated-index| G[Generate Index Page]
    F -->|doc| H[Direct Document Link]
    G --> I[List category contents]
    I --> J[Show description]

Summary

The _category_.json file is a simple yet powerful configuration artifact used to organize documentation content into labeled categories with controlled positioning and linking behavior. It enables automated generation of index pages that improve navigation and user comprehension within a knowledge base or documentation site.