Skip to main content
GitHub Docs serves content for multiple product versions from a single source tree. Two independent mechanisms work together to version content: the 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: A page that applies to all versions includes all three keys. A page that applies only to GitHub Enterprise Server omits 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

Range expressions use the semver format:

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

Use or and and to combine version conditions:

Choosing between frontmatter and Liquid conditionals

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.
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 in data/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 the currentArticle property to create a version-aware cross-link. The link remains valid even if the article URL changes:
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 under data/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:
When this variable is referenced in content, it automatically resolves to the correct value for the current version context.

Versioning tables and lists

When versioning individual rows in a table or items in a list, use whitespace control to avoid introducing stray newlines that break Markdown rendering: