|
| 1 | +--- |
| 2 | +title: Versioning |
| 3 | +sidebar_order: 2 |
| 4 | +--- |
| 5 | + |
| 6 | + |
| 7 | +Versioning allows for the maintenance of multiple versions of the same documentation, which is crucial for supporting different SDK releases. This guide explains how to create versioned documentation in the docs platform. |
| 8 | + |
| 9 | +## Creating a Versioned Page |
| 10 | + |
| 11 | +To create a versioned page: |
| 12 | + |
| 13 | +1. Ensure the original page already exists. |
| 14 | +2. Create a new file with the same name as the original, but append `__v{VERSION}` to the filename (before the extension). |
| 15 | + |
| 16 | +For example, to create version 2.2.0 of `index.mdx`: |
| 17 | + |
| 18 | +``` |
| 19 | +index.mdx (original) |
| 20 | +index__v2.0.0.mdx (version 2.0.0) |
| 21 | +``` |
| 22 | + |
| 23 | +## Versioning Platform Includes |
| 24 | + |
| 25 | +Pages in the `platform-includes` folder can be versioned using the same method. However, the root page referencing these includes must also be versioned. |
| 26 | + |
| 27 | +## File Structure Example |
| 28 | + |
| 29 | +``` |
| 30 | +docs/ |
| 31 | +├── getting-started/ |
| 32 | +│ ├── index.mdx |
| 33 | +│ └── index__v2.mdx |
| 34 | +└── platform-includes/ |
| 35 | + └── configuration/ |
| 36 | + ├── example.mdx |
| 37 | + └── example__v2.mdx |
| 38 | +``` |
| 39 | + |
| 40 | +## Version Selection and User Experience |
| 41 | + |
| 42 | +When multiple versions of a page exist: |
| 43 | + |
| 44 | +1. A dropdown menu appears below the platform selector, displaying all available versions for the current file. |
| 45 | + |
| 46 | +2. When a user selects a version: |
| 47 | + |
| 48 | +- They are redirected to the chosen version of the page. |
| 49 | +- A preference is stored in localStorage, specific to the current guide or platform. |
| 50 | + |
| 51 | +3. An alert is displayed when viewing "non-latest" pages to inform users they're not on the most recent version. |
| 52 | + |
| 53 | +4. If a user has a stored version preference: |
| 54 | + |
| 55 | +- The app will perform a client-side redirect to this version whenever it's available for other pages. |
| 56 | + |
| 57 | +This approach ensures users can easily navigate between versions and maintains their version preference across the documentation. |
| 58 | + |
| 59 | +## Best Practices |
| 60 | + |
| 61 | +1. Only version pages when necessary, to avoid content duplication and save build times. |
| 62 | +2. Ensure all related content (including `platform-includes`) is versioned consistently. |
| 63 | + |
| 64 | + |
| 65 | +## Limitations and Considerations |
| 66 | + |
| 67 | +- Versioning is only available for existing pages. |
| 68 | +- The versioning system relies on the file naming convention, so it's important to follow the `__v{VERSION}` format precisely. |
| 69 | + |
| 70 | +By following these guidelines, it's possible to effectively manage multiple versions of documentation, ensuring users can access the appropriate information for their specific version of the software or API. |
0 commit comments