Principle:Langgenius Dify Documentation
| Knowledge Sources | Dify |
|---|---|
| Domains | Frontend, Documentation |
| Last Updated | 2026-02-12 07:00 GMT |
Overview
Documentation governs the generation of documentation paths and type-safe routing to help documentation pages within the Dify application.
Description
The Documentation principle defines how the Dify frontend maintains a structured, navigable set of help documentation links that connect users to relevant documentation pages. Rather than hardcoding documentation URLs throughout the codebase, the system generates a centralized path registry that maps logical documentation topics to their corresponding URLs. This approach ensures that documentation links remain consistent and updatable from a single location.
The path generation system processes a source definition of documentation routes and produces both runtime constants and TypeScript type definitions. The generated types enable compile-time validation that documentation references in the codebase point to valid topics, catching broken links before they reach production. When documentation is reorganized or URLs change, developers update the source definition and regenerate paths, with the TypeScript compiler flagging any references that need updating.
This principle also covers the organizational patterns for documentation metadata, including categorization of help topics, versioning of documentation links, and support for locale-specific documentation URLs. By centralizing documentation path management, the system supports the broader goal of providing contextual, in-app help that guides users to the right documentation at the right time.
Usage
Use this principle when:
- Generating or updating the centralized documentation path registry
- Adding new help documentation links to UI components
- Implementing type-safe documentation routing with compile-time validation
Theoretical Basis
Documentation path management follows the Indirection principle, introducing a mapping layer between code references and actual documentation URLs to allow independent evolution. The type generation approach applies the principle of static verification, using the type system as a correctness checker for documentation references. This is analogous to the resource bundle pattern used in internationalization, where logical keys are mapped to locale-specific values.