category.json

Overview

The _category_.json file is a configuration file commonly used in documentation systems such as Docusaurus to define metadata for a folder or directory within the documentation structure. Its primary purpose is to organize the documentation content by grouping related documents under a named category, setting the category’s position in the sidebar navigation, and optionally providing a link for the category itself.

This particular _category_.json file defines a category labeled "Contribution" that appears as the 8th item in the sidebar. It also sets up a generated index page for this category with a description pointing to miscellaneous contribution guides.


Detailed Explanation

The file contains a JSON object with the following properties:

Properties

Property

Type

Description

label

String

The display name of the category as it appears in the documentation sidebar.

position

Number

Determines the order of the category in the sidebar. Categories with lower numbers appear higher up.

link

Object

Defines the behavior and content of the category’s landing page or index.

link Object Properties

Property

Type

Description

type

String

Specifies the type of link. Here, "generated-index" means an index page is auto-generated listing the category’s documents.

description

String

A short description shown on the generated index page, summarizing the category's content.


Usage Example

When placed inside a folder in your documentation directory, this _category_.json file will:

Example folder structure:

docs/
├── contribution/
│   ├── _category_.json
│   ├── guide1.md
│   ├── guide2.md

This results in a sidebar entry:


Implementation Details


Interaction with Other Parts of the System


Mermaid Diagram

The following flowchart depicts the role of the _category_.json file in the documentation structure and how it configures the category page and sidebar entry:

flowchart TD
    A[_category_.json] --> B[Category Label: "Contribution"]
    A --> C[Position: 8 in Sidebar]
    A --> D[Generated Index Page]
    D --> E["Description: Miscellaneous contribution guides."]
    B --> F[Sidebar Navigation]
    F --> G[Documents in Folder]

Summary

The _category_.json file is a lightweight, declarative configuration file that organizes documentation content into named categories with custom ordering and optional index pages. It is essential for maintaining a logical and user-friendly documentation navigation structure and is widely used in static site documentation generators.