Overview
Thekosh version commands manage documentation versioning for docs-style sites. Create frozen snapshots of your documentation and maintain multiple versions side-by-side.
Usage
Commands
Show Current Versions
Display all configured versions and identify the current working version.→Arrow marks the latest version[LATEST]badge indicates the current working version- Version name shown with its path in the output directory
Create New Version
Freeze the current latest version and start a new working version.Show Build Information
Display Kosh version and optimization features.Versioning Strategies
Kosh supports two versioning approaches:All-in-Folders Style
All versions, including latest, live in folders:kosh.yaml
- Marks
v3.0as frozen (isLatest: false) - Creates new
content/v4.0/folder (copies fromv3.0) - Sets
v4.0as latest
Traditional Style (Root Latest)
Latest version at root, old versions in folders:kosh.yaml
- Copies root content to
content/v3.0/ - Updates
v3.0config:path: v3.0,isLatest: false - Creates new
v4.0entry:path: "",isLatest: true
Version Creation Process
When you runkosh version v4.0:
-
Validation
- Check if version name already exists
- Verify a latest version exists
- Detect versioning strategy from config
-
Content Snapshot
- All-in-folders: Copy
content/v3.0/→content/v4.0/ - Traditional: Copy
content/→content/v3.0/ - Only
.mdfiles are copied - Version folders are excluded from snapshot
- All-in-folders: Copy
-
Config Update
- Mark old latest as frozen (
isLatest: false) - Add new version at top of list
- Preserve YAML formatting and comments
- Update path fields based on strategy
- Mark old latest as frozen (
-
Directory Handling
- Existing unregistered directories trigger backup warning
- Conflicts abort the operation
- Creates parent directories as needed
Version URLs
After building, versions are accessible at:Cleaning Behavior
Thekosh clean command respects versioning:
Error Handling
Directory Exists
If the target directory exists but isn’t registered:Directory Conflicts
If a registered version’s directory exists:Config Errors
Can’t load config:Version Metadata
Posts can access their version in frontmatter:content/v2.0/getting-started.md
version field is automatically set during build based on the post’s location.
Best Practices
Version Naming
Use semantic versioning:v1.0,v2.0,v3.0- Major versionsv2.1,v2.2- Minor versions (if needed)
When to Version
Create a new version when:- Making breaking API changes
- Restructuring documentation significantly
- Releasing a major product update
- Minor content updates
- Typo fixes
- New pages that apply to all versions
Sparse Versioning
Only copy files that differ between versions. Use symlinks or theme logic to fall back to latest for unchanged content.Migration Checklist
Related Commands
kosh build- Build all versionskosh clean- Clean with version awareness