category.json
Overview
The _category_.json file is a configuration file used primarily in documentation systems and static site generators (such as Docusaurus) to define metadata and organizational structure for a category or folder of documents. This file allows specifying properties like the category’s label (display name), position (ordering), and link behavior within navigation menus or indexes.
In this specific file, the purpose is to define a category named "References" with a given position and a generated index link that provides miscellaneous references related to the documentation.
File Structure and Contents
The file is a JSON object with the following key-value pairs:
Property | Type | Description |
|---|---|---|
label | string | The display name for the category in navigation menus. |
position | number | An integer used to order categories relative to others. Lower numbers appear earlier. |
link | object | Defines the type and parameters of a navigation link associated with the category. |
link Object Details
Property | Type | Description |
|---|---|---|
type | string | The kind of link. In this file, "generated-index" indicates an auto-generated index page. |
description | string | A short description of the generated index page content or category purpose. |
Explanation of Properties
label:
This is the human-readable name of the category shown in the sidebar or navigation menu. Here, it is"References".position:
Determines the order in which this category appears relative to others in the sidebar. A lower number means higher priority (appears first). Here, it is set to6.link:
Specifies the linking behavior when users click on the category name. The "generated-index" type means an index page will be automatically created based on the documents within this category, and "description" provides a summary shown on that index page.
Usage Example
If you have a folder named references in your documentation source, placing this _category_.json file there will:
Label the folder/category as "References" in the sidebar.
Position it at the 6th place among other categories.
Automatically generate an index page summarizing all documents under this category with the description "Miscellaneous References."
Implementation Details and Behavior
The file does not contain any executable code; it is a configuration file read by the documentation framework.
The "generated-index" link type triggers the static site generator to create an index page dynamically from the contents of the folder.
This approach helps maintain navigation consistency and reduces manual index page creation.
Interaction with Other System Parts
The
category.jsonfile interacts with the documentation generator’s sidebar and navigation components.It affects how the category appears in the sidebar and what happens when users click on the category title.
It relies on the documentation build process to parse this file and generate the appropriate navigation structure and index pages.
Other markdown or documentation files inside the same folder contribute to the generated index page linked by this category.
Mermaid Diagram: Flowchart of Category Configuration Usage
flowchart TD
A[_category_.json file] --> B[Documentation Generator]
B --> C[Sidebar Navigation]
B --> D[Generated Index Page]
C --> E[Display "References" Label at Position 6]
D --> F[Show "Miscellaneous References" Description]
subgraph Folder
G[Documentation Files]
end
G --> D
Summary
The _category_.json file is a simple yet powerful configuration file to organize documentation into well-labeled and ordered categories with automatically generated index pages. This promotes a scalable and maintainable documentation structure with minimal manual effort.