A modular and extensible JSON Schema for defining hierarchical sidebar navigation structures in content platforms, documentation tools, and UI frameworks.
Ideal for static site generators, developer portals, CMS integrations, or schema-driven UIs.
This repository contains a versioned specification for sidebar layout models. Built with composability and clarity in mind, the schema supports:
Whether youβre building a static site generator, documentation renderer, or a dynamic navigation engineβthis model is adaptable to your workflow.
.
βββ README.md
βββ CHANGELOG.md
βββ package.json
βββ docs/
β βββ definitions.md
β βββ integrations-guide.md
β βββ overview.md
βββ schema/
β βββ v1.0.0/
β β βββ sidebar.schema.json
β β βββ samples/
β β βββ example.yaml
β βββ latest/
β βββ sidebar.schema.json
β βββ samples/
β βββ example.yaml
βββ scripts/
β βββ yamlToMarkdown.js
β βββ markdownToYaml.js
latest/
is a pointer to the most recent version of the schema for easy integration. Update it manually on each release, or use a script/symlink strategy.$defs
and allOf
id
(filename-like), slug
, and flexible path
yamlToMarkdown.js
Description:
Converts sidebar YAML files (matching the schema) into readable, structured Markdown navigation lists.
Supports preservation of YAML comments (before each sidebar entry) as Markdown paragraphs, and includes metadata such as the YAML filename and timestamp as Markdown comments.
Features:
_property_: value
.Usage Example:
const fs = require('fs');
const { parseYamlWithSidebarComments, convertDataToMarkdown } = require('./scripts/yamlToMarkdown');
const yamlContent = fs.readFileSync('sidebars.yaml', 'utf8');
const data = parseYamlWithSidebarComments(yamlContent);
convertDataToMarkdown(data, { yamlFilePath: 'sidebars.yaml' }).then(markdown => {
fs.writeFileSync('sidebars.md', markdown);
});
markdownToYaml.js
Description:
Converts Markdown navigation lists (as generated by yamlToMarkdown.js
) back into YAML, reconstructing the sidebar structure and restoring comments as YAML comments.
Features:
Usage Example:
const fs = require('fs');
const { convertMarkdownToYaml } = require('./scripts/markdownToYaml');
const markdownContent = fs.readFileSync('sidebars.md', 'utf8');
const yaml = convertMarkdownToYaml(markdownContent, { markdownFilePath: 'sidebars.md' });
fs.writeFileSync('sidebars.generated.yaml', yaml);
Both scripts require the following libraries (see package.json
):
js-yaml
yaml
prettier
(with plugins: prettier/plugins/estree
, prettier/plugins/yaml
, prettier/plugins/markdown
)Install all dependencies with:
npm install
Clone the repo:
git clone https://github.com/your-username/sidebar-navigation-model.git
Explore:
overview.md
: High-level schema purpose and structuredefinitions.md
: Breakdown of reusable componentsintegrations-guide.md
: How to integrate with static site generators or client appsWe follow Semantic Versioning for schema releases. Refer to the CHANGELOG.md for a history of changes.
Contributions are welcome! See our contributing guide to get started.
Have a question or feedback? Please use one of the following channels:
Released under the MIT License. Use it freely in commercial and open-source projects.