DocsJsonManager from Mintlify.Core to intelligently merge multiple
navigation sources without duplication.
Overview
Navigation generation happens in five distinct phases:Load Template Navigation
If a
MintlifyTemplate is defined in the .docsproj file, it’s loaded first as the foundation for navigation structure.Discover Conceptual Docs
The system scans the documentation root folder for existing
.mdx files, automatically organizing them into navigation groups while preserving template structure.Add API Reference
Generated API documentation is added to the navigation, organized either as a unified structure or by assembly depending on
NavigationMode.Apply NavigationType
If the template specifies a
NavigationType, the root project’s navigation is moved to Tabs or Products section.Phase 1: Template Navigation
The.docsproj file can define a MintlifyTemplate that provides the baseline documentation structure. This template becomes the foundation that all other navigation is merged into.
Template Structure
CloudNimble.DotNetDocs.Docs.docsproj
Template Loading Process
When the MintlifyRenderer starts, it checks if a template is provided:- Load or Create Default: If
_options.Templateexists, load it; otherwise create a default configuration - Initialize DocsJsonManager: Pass the template config to
DocsJsonManager.Load(DocsJsonConfig) - Track Known Paths: All paths in the template are added to
_knownPagePathsfor duplicate detection
MintlifyRenderer.cs:82-94
The template provides the structure and styling (theme, colors, logos) that remains constant, while navigation gets intelligently merged from multiple sources.
Phase 2: Folder Scanning
After loading the template, the system scans the documentation root directory for existing.mdx files using PopulateNavigationFromPath.
Scanning Behavior
Excluded Directories The scanner automatically excludes certain directories:- Directories starting with
.(hidden directories) node_modules(package dependencies)conceptual(reserved for overrides)overrides(reserved for customization)api-reference(handled separately in Phase 3)
.mdx files are included in navigation:
.mdxfiles: Added to navigation automatically.mdfiles: Generate warnings and are excluded- Other files: Ignored completely
index.mdx are prioritized and appear first in their group.
Navigation Overrides
Any directory can include a navigation.json file for complete control:
guides/navigation.json
navigation.json is found, the system:
- Stops automatic navigation generation for that directory tree
- Uses the custom
GroupConfigobject as-is - Tracks all paths in the custom navigation
preserveExisting: true parameter ensures template navigation is preserved:
- Existing template groups remain in their original position
- Discovered content is merged into matching groups by name
- New groups are appended after template groups
- Duplicate paths are detected and skipped using
_knownPagePaths
Folder Scanning Code
MintlifyRenderer.cs:124
Phase 3: API Reference Generation
The final phase adds generated API documentation to the navigation structure. The organization depends on theNavigationMode setting.
Navigation Modes
- Unified Mode (Default)
- ByAssembly Mode
Creates a single “API Reference” group with hierarchical namespace organization:Best for: Single-project solutions where all APIs logically belong together
API Reference Code Flow
MintlifyRenderer.cs:127
BuildNavigationStructure method:
- Finds or creates the API Reference group using
FindOrCreateApiReferenceGroup - Iterates through all namespaces in the documentation model
- Creates nested groups for namespace hierarchy (e.g.,
CloudNimble�DotNetDocs�Core) - Adds page paths for each type using
_docsJsonManager.AddPage() - Respects the
_knownPagePathshashset to avoid duplicates
Phase 4: Documentation References (Collections)
DotNetDocs supports creating documentation collections by combining multiple.docsproj projects into a unified documentation site. This is perfect for multi-library ecosystems or monorepo documentation.
DocumentationReference Basics
Add references to other documentation projects in your.docsproj file:
CloudNimble.EasyAF.Docs.docsproj
Include: Path to the referenced.docsprojfileDestinationPath: Subfolder where documentation will be copied (relative to output)IntegrationType: How the reference appears in navigation (TabsorProducts)
How It Works
When you build a project with DocumentationReferences:- Resolution: The
DocumentationReferenceResolverTaskvalidates each reference and extracts metadata - File Copying: Content files (
.mdx, images, snippets) are copied toDestinationPath - Navigation files excluded: Root navigation files (
docs.json) are automatically excluded - Navigation Integration: Referenced navigation is merged into the parent project’s
docs.json
Integration Types
- Tabs (Default)
- Products
Referenced documentation appears as a top-level tab:Best for: Related libraries or companion tools that deserve their own dedicated section
Result in docs.json
File Copying Behavior
The system automatically copies documentation-type-specific files while excluding root navigation files: Mintlify (excludesdocs.json):
*.md,*.mdx,*.mdzimages/**/*favicon.*snippets/**/*
toc.yml, toc.yaml, docfx.json):
*.md,*.yml,*.yamlimages/**/*articles/**/*api/**/*
mkdocs.yml):
*.mddocs/**/*overrides/**/*theme/**/*
Root navigation files are excluded automatically to prevent conflicts. The parent project maintains full control over the unified navigation structure.
Complete Example: Multi-Library Collection
CloudNimble.Platform.Docs.docsproj
Controlling Root Project Navigation Type
By default, the root project’s documentation appears in the mainPages navigation. You can change this behavior using the NavigationType and NavigationName properties in your MintlifyTemplate.
NavigationType Property
Add to your.docsproj template:
Pages(default) - Appears in main navigationTabs- Appears as a top-level tabProducts- Appears in products section
When to Use NavigationType
Use Pages (default)
When: You’re building a single-project documentation siteThe root project should be the primary content in the main navigation.
Use Tabs
When: You’re building a multi-project collection where all projects should have equal prominencePerfect for monorepos or related library collections.
Use Products
When: You’re documenting a product suite with multiple distinct offeringsEach product gets its own section in the products navigation.
Example: Pure Collection Site
Collection.Docs.docsproj
NavigationType Processing Order
The system applies navigation transformations in this order:- Load Template - Base configuration and styling
- Discover Files - Scan for conceptual
.mdxfiles - Add API Reference - Generated API documentation
- Apply NavigationType - Move root content to Tabs/Products if configured
- Combine References - Merge DocumentationReference navigation
DocsJsonManager Deep Dive
TheDocsJsonManager from Mintlify.Core is the engine that powers intelligent navigation merging.
Key Features
Duplicate Detection
The
_knownPagePaths HashSet tracks every path added to navigation, preventing duplicates across template, discovered, and generated content.Smart Group Merging
Groups with matching names are automatically merged. Pages from multiple sources combine into a single cohesive group.
Hierarchical Path Tracking
The
AddPage(string groupPath, string pagePath) method supports slash-separated paths like “Getting Started/API Reference” for nested groups.Validation & Cleanup
Automatically removes groups with null names that would cause Mintlify to reject the configuration.
Core Methods
Load(DocsJsonConfig) Loads a configuration object and populates_knownPagePaths by recursively scanning all navigation:
DocsJsonManager.cs:159-172
.mdx files and builds navigation structure:
DocsJsonManager.cs:444-483
path: Root directory to scanfileExtensions: Array of extensions (default:[".mdx"])includeApiReference: Whether to scanapi-referencefolder (default:false)preserveExisting: Merge with existing navigation vs replace (default:true)allowDuplicatePaths: Whether to allow duplicate page paths (default:false)
DocsJsonManager.cs:493-512
true if page was added, false if it was a duplicate and skipped.
MergeNavigation
Intelligently merges two navigation structures:
DocsJsonManager.cs:890-943
- Pages: Deduplicated using
_knownPagePaths - Groups: Merged by name, combining pages recursively
- Tabs: Merged by name or href
- Anchors: Appended to target
DocsJsonManager.cs:591-611
Configuration Examples
Unified Navigation with Template
ByAssembly Navigation
Custom Navigation Override
Createguides/navigation.json in your documentation folder:
guides directory.
Best Practices
Use Templates for Structure
Define your site structure (Getting Started, Guides, etc.) in the
.docsproj template. Let folder scanning fill in the content.Organize by Concern
Create directories that match your template groups. Files in
guides/ will merge into the “Guides” group automatically.Override When Needed
Use
navigation.json for complex sections where automatic discovery doesn’t match your desired structure.Name Files Descriptively
File names become URLs. Use
kebab-case.mdx for clean, readable paths like /guides/getting-started.Keep API Reference Separate
Never manually create files in
api-reference/. This folder is fully managed by the generator and will be overwritten.Test Incremental Builds
The duplicate detection system preserves navigation across multiple builds. Test that your structure remains stable.
Troubleshooting
Duplicate Pages in Navigation Symptom: Same page appears multiple times in navigation Cause:allowDuplicatePaths is enabled or paths are tracked incorrectly
Solution:
- Ensure
allowDuplicatePaths: falsein your .docsproj - Check that template paths match discovered paths exactly (case-insensitive)
- Review
navigation.jsonfiles for duplicate references
.mdx files exist but don’t appear in navigation
Cause: Files are in excluded directories or have wrong extension
Solution:
- Check that files are
.mdxnot.md - Verify files aren’t in
node_modules,conceptual,overrides, or hidden directories - Set
includeApiReference: trueif you need to scan that folder
preserveExisting: false in folder scanning
Solution: Ensure PopulateNavigationFromPath uses preserveExisting: true (this is the default)
API Reference Not Generated
Symptom: No API Reference group appears in navigation
Cause: GenerateDocsJson is disabled or no types were documented
Solution:
- Set
<GenerateDocumentation>true</GenerateDocumentation>in .docsproj - Verify XML documentation is enabled:
<GenerateDocumentationFile>true</GenerateDocumentationFile> - Check that assemblies contain public types with XML comments