Custom Code
Custom HTML, CSS, and JavaScript can be added to extend your documentation.
How It Works
Custom code is injected into the <head>
tag of your documentation site and applies to all published pages. This allows you to add external scripts, stylesheets, and custom JavaScript functions to enhance your documentation.
Common Uses
Analytics
- Google Analytics or Plausible for usage tracking
- Event tracking and user behavior analysis
- Custom metrics and dimensions
CSS Customization
- Custom fonts and colors
- Layout modifications
- Mobile responsiveness adjustments
- Print styles
External Tools
- Chat widgets
- Feedback forms
- Search enhancements
- Authentication systems
Best Practices
Performance
Your custom code directly impacts site performance. Load external resources asynchronously when possible and minimize HTTP requests. Use compression and minification for your code to reduce load times.
Security
Keep security in mind when adding custom code. Use HTTPS for external resources and avoid storing sensitive data in client-side code. Regularly update any third-party dependencies and always validate dynamic content.
Implementation
Custom code changes apply directly to your live site without a preview environment. Before adding any code, check for syntax errors and test thoroughly. Since invalid code can break your documentation, always back up your customizations and verify browser compatibility.