Simpledocs Boilerplate

Adding Contents

Adding content to Simpledocs involves structuring and organizing information in a clear and accessible manner. This ensures that documentation remains easy to navigate and understand. Simpledocs uses a single JSON file located at $lib/documentation.json to store and manage all page contents, allowing for seamless updates, structured data handling, and efficient content retrieval.

Basic Concept

The JSON file follows a structured format that organizes documentation pages into sections and paragraphs. The JSON is structured as an array of objects, where each object represents a category that has a documentation page or more. Each page contains sections, and each section consists of paragraphs. Here’s an example structure, as can be seen below.

In Simpledocs, the JSON structure organizes documentation into categories, pages, and contents for a clear and structured navigation system. The top level is an array where each object represents a category, acting as a container for related pages. The name property defines the category title, which helps in grouping documentation topics logically.

Each category contains a pages array that holds individual documentation pages. Every page has a title for display, a slug for unique identification in URLs, and a contents array that stores all structured information for that page. The contents array will later hold sections, paragraphs, or other content elements that make up the documentation. This structured approach ensures easy content management, making it simple to organize, retrieve, and update documentation.

Now, let's try to add a paragraph to the example page.

In the structure above, the page now contains a single paragraph. To add more paragraphs, simply append additional strings to the array. This keeps the documentation flexible and easy to update without modifying the overall structure.

Now how about adding a page section? By adding a page section, it can help us in grouping and organizing different contexts inside a page. So let’s try adding one, followed by another paragraph.

Notice that a page section is not a string but an object. This object consists of type and value, which define its type as a section title and what text it will display on the page. We will discover more variations of these types in the next parts.

Simpledocs by Mfc © 2025
This web page is licensed under MIT