The versions subject handles product versioning for GitHub Docs, including Free/Pro/Team (FPT), Enterprise Cloud (GHEC), and Enterprise Server (GHES). It provides version detection, resolution, feature flags, and version-aware content rendering.
This subject is responsible for:
- Defining all available product versions (plans and releases)
- Detecting current version from URL paths
- Providing version-aware Liquid conditionals (e.g.,
{% if ghes %}) - Managing feature flags that vary by version
- Version resolution for content applicability
- Version picker UI component
- Deprecation banners for old versions
Related subjects:
src/archives/- Handles archived versions of documentationsrc/ghes-releases/- Manages GHES release and deprecation processes
lib/all-versions.ts-allVersionsobject: Defines all version plans (fpt, ghec, ghes) with releaseslib/enterprise-server-releases.ts- GHES version data: supported, deprecated, latest releaseslib/get-applicable-versions.ts-getApplicableVersions(): Determines which versions apply to content based on frontmattermiddleware/short-versions.ts- Adds version shortcuts (e.g.,ghes,fpt) toreq.contextmiddleware/features.ts- Loads feature flags fromdata/features/and adds to contextcomponents/VersionPicker.tsx- UI component for switching between versions
Versions follow the format: plan@release
- FPT:
free-pro-team@latest(stripped from URLs) - GHEC:
enterprise-cloud@latest - GHES:
enterprise-server@3.11,enterprise-server@3.10, etc.
Middleware adds version shortcuts to context for use in Liquid templates:
{% if fpt %}
This content only appears for Free/Pro/Team.
{% endif %}
{% if ghes %}
This content appears for all GHES versions.
{% endif %}
{% if ghes > 3.9 %}
This content appears for GHES 3.10 and later.
{% endif %}Feature flags in data/features/*.yml control content visibility:
# data/features/my-feature.yml
versions:
fpt: '*'
ghec: '*'
ghes: '>= 3.10'In Liquid:
{% if my-feature %}
This content only shows when my-feature is enabled.
{% endif %}Content files specify applicable versions in frontmatter:
versions:
fpt: '*'
ghec: '*'
ghes: '>= 3.8'npm run test -- src/versions/testsdata/features/*.yml- Feature flag definitionslib/enterprise-server-releases.ts- GHES version data- Content frontmatter -
versionsfield specifies applicable versions - URL paths - Version extracted from path (e.g.,
/enterprise-server@3.11/)
@/frame- Path utilities for version extraction@/data-directory- Loads feature flag data@/archives- Archived version handling@/ghes-releases- GHES release management
req.context.currentVersion- String likeenterprise-server@3.11req.context.currentVersionObj- Full version object with metadatareq.context[shortName]- Boolean flags:fpt,ghec,ghesreq.context[featureName]- Boolean flags for each featurereq.context.allVersions- All available versions
src/archives- Handles archived/deprecated version proxyingsrc/ghes-releases- GHES release notes and deprecationsrc/frame- Path utilities used for version detectionsrc/redirects- Version-aware redirects
- Team: Docs Engineering
When no version in URL, fallback order: FPT → GHEC → GHES latest. Implemented in lib/redirects/permalinks.ts.
- Supported versions defined in
enterprise-server-releases.ts - New GHES releases added via scripts in
src/ghes-releases/scripts/ - Deprecated versions archived via
src/archives/
- FPT version is stripped from URLs but exists internally
- Feature flag data loaded on every request (cached per version)
- Version comparison logic only supports GHES numbered releases
- REST API versions handled separately via config in
src/rest/lib/config.json
- Update
src/versions/lib/enterprise-server-releases.ts - Run GHES release scripts (see
src/ghes-releases/scripts/) - Update REST API config if needed
- Create release notes in
data/release-notes/
- Move version from
supportedtodeprecatedinenterprise-server-releases.ts - Run archive scripts to freeze content (see
src/archives/) - Update redirects as needed