versions frontmatter field restricts which versions include a given page, and Liquid conditionals inside the page body conditionally render specific paragraphs, sentences, or code blocks.
Product versions
GitHub Docs recognizes three top-level product versions:| Version key | Product |
|---|---|
fpt | GitHub.com free, pro, and team plans (free-pro-team) |
ghes | GitHub Enterprise Server |
ghec | GitHub Enterprise Cloud |
fpt and ghec.
As of early 2021,
fpt URLs do not include the version segment. A helper function (src/versions/lib/remove-fpt-from-path.ts) strips free-pro-team@latest from rendered URLs automatically. Links to fpt content do not require version prefixes.The versions frontmatter field
The versions field is required on every page. Its value is an object whose keys are version identifiers. The value for each key is a semver range expression that controls which releases of that version include the page.
Use '*' to include all releases of a version:
Version range examples
| Expression | Meaning |
|---|---|
'*' | All releases |
'>=3.0' | Version 3.0 and later |
'>=2.22 <3.1' | Versions 2.22, 2.23, and 3.0, but not 3.1 |
Liquid version conditionals
Within the body of a page, use{% ifversion %} to conditionally render content. Liquid conditionals are processed at render time based on the version the reader is currently viewing.
Basic conditional
Conditional with else
Multi-branch conditional
Version range in Liquid
Combining version checks
Useor and and to combine version conditions:
Choosing between frontmatter and Liquid conditionals
Use versions frontmatter when...
Use versions frontmatter when...
The entire page only applies to certain versions. If a page describes a feature that does not exist on GitHub Enterprise Server at all, exclude the
ghes key from versions. Readers on a GHES-scoped docs site will receive a 404 rather than landing on an irrelevant page.Use Liquid conditionals when...
Use Liquid conditionals when...
Part of a page varies by version. If a feature works on all versions but the UI differs, keep the page visible to all versions and use
{% ifversion %} blocks around the version-specific paragraphs or steps.Feature-based versioning
For features that span multiple product versions but shipped at different times across those versions, you can define a named feature flag indata/features/ rather than repeating a complex version expression everywhere. The feature file specifies a versions object using the same semver syntax, and pages reference it by name:
Linking across versions
Linking to the same article in a different version
Use thecurrentArticle property to create a version-aware cross-link. The link remains valid even if the article URL changes:
Preventing link transformation
By default, internal links are rewritten to match the reader’s current version. To pin a link to a specific version — for example, linking to a GitHub.com-only terms page from Enterprise content — include the version in the path:Versioning reusables and variables
Liquid conditionals can appear inside reusable Markdown files underdata/reusables/ and inside variable YAML values in data/variables/. This allows a single reusable or variable to render different text depending on the current version.
Example from data/variables/product.yml: