category.json

Overview

The _category_.json file is a configuration file used primarily in documentation or knowledge base systems that support category grouping and navigation. Its main purpose is to define metadata for a documentation category, including a label, position within a navigation order, and a link configuration to control how the category index page is generated and described.

This file enables better organization and user navigation by grouping related documents under a common category with a clear label and order, and by linking to an automatically generated index page with a helpful description.


File Structure and Properties

The file contains a single JSON object with the following key properties:

Property

Type

Description

label

String

The display name of the category, shown in navigation menus or category headers.

position

Number

Numerical value defining the order of the category among siblings; lower numbers appear first.

link

Object

Defines the behavior of the category's link in the navigation, typically for auto-generated index pages.

label

position

link

"link": {
  "type": "generated-index",
  "description": "Best practices on configuring a knowledge base."
}

This setup instructs the documentation system to create an index page summarizing the category contents, with the given description to guide readers.


Usage Example

In a documentation project, place _category_.json files inside folders representing categories. For example:

docs/
└── best-practices/
    ├── _category_.json
    ├── article1.md
    └── article2.md

The _category_.json might contain:

{
  "label": "Best practices",
  "position": 11,
  "link": {
    "type": "generated-index",
    "description": "Best practices on configuring a knowledge base."
  }
}

This will:


Implementation Details and Interaction


Interaction with Other Parts of the System


Mermaid Diagram

The following flowchart illustrates the structure and role of the _category_.json file within the documentation system:

flowchart TD
    A[_category_.json] --> B[label: "Best practices"]
    A --> C[position: 11]
    A --> D[link: generated-index]
    D --> E[description: "Best practices on configuring a knowledge base."]
    A -.-> F[Category Folder (best-practices)]
    F --> G[Documentation Files (article1.md, article2.md, ...)]
    A --> H[Navigation System]
    H --> I[Sidebar Ordering & Labels]
    H --> J[Generated Category Index Page]

Summary

The _category_.json file is a simple yet powerful configuration artifact that defines category labels, ordering, and index page metadata to organize and enhance navigation within documentation projects. It allows documentation frameworks to automatically generate navigable category pages with meaningful descriptions, improving the overall user experience.