Navigation Configuration
This directory contains configuration files for managing navigation across Jan's documentation sites.
Overview
As Jan grows to include multiple products (Jan Desktop, Jan Server, Jan Mobile, etc.), we need a scalable way to manage navigation across different documentation sections. This configuration approach allows us to:
- Maintain consistency across different products
- Avoid duplication in navigation code
- Scale easily as new products are added
- Separate concerns between regular docs and API reference pages
Structure
navigation.js
Central navigation configuration file containing:
- Product-specific navigation links
- API deployment configurations
- Helper functions for navigation management
- Feature flags for navigation behavior
Navigation Strategy
Regular Documentation Pages
- Navigation is injected via
astro.config.mjs - Shows "Docs" and "API Reference" links
- Appears in the main header next to search
API Reference Pages
- Have their own navigation via
ApiReferenceLayout.astro - Navigation is built into the layout (not injected)
- Prevents duplicate navigation elements
Adding New Products
To add navigation for a new product:
- Update
navigation.js:
products: {
janServer: {
name: 'Jan Server',
links: [
{ href: '/server', text: 'Server Docs', isActive: (path) => path.startsWith('/server') },
{ href: '/server/api', text: 'Server API', isActive: (path) => path.startsWith('/server/api') }
]
}
}
-
Update
astro.config.mjsif needed to handle product-specific logic -
Create corresponding layout components if the product needs custom API reference pages
Configuration in astro.config.mjs
The navigation injection in astro.config.mjs is kept minimal and clean:
const JAN_NAV_CONFIG = {
links: [/* navigation links */],
excludePaths: [/* paths that have their own navigation */]
};
This configuration:
- Is easy to read and modify
- Doesn't interfere with API reference pages
- Can be extended for multiple products
- Maintains clean separation of concerns
Best Practices
- Keep it simple: Navigation configuration should be declarative, not complex logic
- Avoid duplication: Use the configuration to generate navigation, don't hardcode it multiple places
- Test changes: Always verify navigation works on both regular docs and API reference pages
- Document changes: Update this README when adding new products or changing navigation strategy
Testing Navigation
After making changes, verify:
- Navigation appears correctly on regular docs pages
- Navigation doesn't duplicate on API reference pages
- Active states work correctly
- Mobile responsiveness is maintained
- Theme switching doesn't break navigation
Future Considerations
- Product switcher: Add a dropdown to switch between different product docs
- Version selector: Add version switching for API documentation
- Search integration: Integrate product-specific search scopes
- Analytics: Track navigation usage to improve UX
Related Files
/astro.config.mjs- Navigation injection for regular docs/src/components/ApiReferenceLayout.astro- API reference navigation/src/pages/api.astro- API documentation landing page/src/pages/api-reference/*.astro- API reference pages