Best Practices
Guidelines for optimal graph plugin usage and documentation structure.
Documentation Structure
Create Meaningful Connections
Link related pages to create useful graphs:
✅ Good:
See [Installation Guide](installation.md) for setup instructions.
Related: [Configuration](config.md), [Troubleshooting](troubleshooting.md)
❌ Bad:
Use Consistent Linking Patterns
Establish patterns for how pages link to each other:
Hub-and-Spoke:
Sequential:
Cross-Referenced:
Avoid Orphan Pages
Every page should have at least one incoming or outgoing link:
Configuration Best Practices
Start with Defaults
Begin with default configuration and adjust based on results:
Then customize:
Match Config to Site Size
| Site Size | Recommended Depth | Hover Effects |
|---|---|---|
| < 50 pages | 2-3 | Enabled |
| 50-100 pages | 2 | Enabled |
| 100-500 pages | 1 | Enabled |
| > 500 pages | 1 | Disabled |
Test on Real Data
Don't guess at configuration - build and test:
mkdocs serve- Navigate to various pages
- Check graph appearance
- Adjust configuration
- Repeat
Performance Best Practices
For Large Documentation
Optimize for performance:
plugins:
- graph-view:
local_graph_depth: 1 # Minimize nodes
focus_on_hover: false # Reduce JS work
enable_drag: false # Simplify interactions
Monitor Build Time
Check how the plugin affects build time:
If slow, consider: - Reducing graph depth - Disabling features - Using conditional enabling
Lazy Load Full Graph
The full graph is lazy-loaded by default - don't change this unless necessary.
Content Best Practices
Link Contextually
Add links where they make sense in content:
✅ Good:
❌ Bad:
Use Descriptive Link Text
Help users understand what they'll find:
✅ Good:
❌ Bad:
Balance Links
Too few = disconnected graph Too many = cluttered graph
Aim for: 3-7 outgoing links per page
Visual Best Practices
Readable Font Sizes
Choose font sizes appropriate for your theme:
Material Theme: 10-12px Other Themes: Test and adjust
Balanced Spacing
Adjust spacing so nodes don't overlap but aren't too sparse:
plugins:
- graph-view:
repel_force: 1.0 # Adjust between 0.5-1.5
link_distance: 50 # Adjust between 30-70
Test Both Themes
If your site has dark mode, test graph in both:
- Switch to dark mode
- Check label visibility
- Verify color contrast
- Adjust if needed
Mobile Best Practices
Mobile-Friendly Config
Optimize for touch devices:
plugins:
- graph-view:
font_size: 12 # Larger for mobile
enable_drag: true # Touch drag
enable_zoom: true # Pinch zoom
focus_on_hover: false # Better for touch
Test on Mobile
Always test on actual mobile devices:
- Build documentation
- View on phone/tablet
- Check graph positioning
- Verify interactions work
- Adjust configuration
Accessibility Best Practices
Provide Alternative Navigation
Don't rely solely on graph for navigation:
- Include navigation sidebar
- Add breadcrumbs
- Provide search functionality
- Use clear page hierarchies
Descriptive Page Titles
Page titles appear as node labels:
✅ Good: "Installation Guide" ❌ Bad: "Guide" or "Page 1"
Keyboard Access
Ensure graph is keyboard-accessible:
- Tab through nodes
- Enter to navigate
- Escape to close overlay
Maintenance Best Practices
Regular Audits
Periodically check your graph:
- Build documentation
- Open full graph view
- Look for isolated nodes
- Check for unexpected connections
- Fix broken links
Document Your Configuration
Add comments to your configuration:
plugins:
- graph-view:
# Depth of 2 works well for our ~75 pages
local_graph_depth: 2
# Disabled for performance on mobile
focus_on_hover: false
Version Control
Track configuration changes in git:
Common Pitfalls to Avoid
Too Deep Depth
❌ Don't set local_graph_depth: 5 on large sites
✅ Use local_graph_depth: 1-2
Too Many Features Enabled
❌ Don't enable every feature on large sites ✅ Disable what you don't need for performance
Inconsistent Link Styles
❌ Don't mix absolute and relative links randomly ✅ Choose one style and stick to it
Ignoring Mobile
❌ Don't only test on desktop ✅ Always test mobile layout and interactions
No Testing
❌ Don't change config without testing ✅ Test every configuration change
Next Steps
- Review Configuration Examples
- Read Advanced Features
- Check Options Reference