Overview
EasyGoDocs uses a structured JSON format to define documentation pages. Each JSON file insrc/db/ represents a complete documentation page with its content, navigation structure, table of contents, and metadata.
This approach separates content from presentation, making it easy to manage documentation programmatically and render it consistently across different views.
JSON Schema
A documentation JSON file consists of five main sections:1. Document Metadata
Basic information about the documentation:id(string, required): Unique identifier used in URL routing (/docs/{id})title(string, required): Display title for the documentation pagedescription(string, optional): Brief description for SEO and page headers
2. Sidebar Navigation
Defines the left sidebar navigation structure:- Each item has
title,href, and optionalchildrenarray hreflinks to section IDs in the content (using#anchors)- Supports nested navigation with unlimited depth
- Children are collapsible/expandable in the UI
3. Table of Contents
Defines the right-side table of contents:id(string): Must match the content block’sidfor scroll trackingtitle(string): Display text in the TOClevel(number): Heading level (1-6) for indentation and styling
The TOC uses IntersectionObserver to automatically highlight the current section as users scroll through the page.
4. Content Blocks
The actual documentation content as an array of typed blocks:Heading
level: 1-6 (h1-h6)id: Required for anchor links and TOC tracking
Paragraph
List
Code Block
language: Used for syntax highlightingcode: Raw code string (use\nfor line breaks)
Image
5. Credits (Optional)
Author and contributor information:Complete Example
Here’s the complete structure fromsrc/db/react.json:
Best Practices
Keep IDs Consistent
Ensure that heading IDs incontent match the IDs in toc and href values in sidebar:
Use Descriptive IDs
Use kebab-case and descriptive names:Structure Your Content
Organize content hierarchically with clear heading levels:TypeScript Interfaces
The JSON structure maps to these TypeScript interfaces insrc/components/documentation/documentation-component.tsx:
Next Steps
TSX Templates
Learn how TSX templates render JSON data into interactive documentation
Navigation
Understand how navigation, routing, and content discovery works