A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://docs.github.com/en/contributing/writing-for-github-docs/versioning-documentation below:

Versioning documentation - GitHub Docs

GitHub Docs uses YAML frontmatter and liquid operators to support multiple versions of GitHub with a single-source approach.

On GitHub Docs, we provide versions of our documentation that reflect the differences in UI and functionality across GitHub's major product offerings. Contributors can use versioning syntax to scope content to a specific product offering.

Versioning syntax allows the reader to manually choose the version of the documentation that applies to the product they're using. GitHub Docs' URLs can also include versioning information, which allows links from one version of GitHub Docs to another to send the reader directly to documentation for the product they're using.

How and where to version

Versioning for content on GitHub Docs is single-source to avoid repetition and keep prose DRY. For articles, you apply versioning to an individual Markdown file with YAML metadata, then use conditional statements within the file's prose to instruct the site which text to display depending on the version the reader selects. Single-sourcing contrasts to the creation of separate files that reflect each version of the content.

There are two types of versioning syntax for GitHub Docs.

About the different versions of GitHub

We provide versioned documentation for users of GitHub plans including GitHub Enterprise Cloud and GitHub Enterprise Server. If multiple versions of a page exist on the site, readers can choose the version from the version picker at the top of the page.

GitHub.com

Documentation for GitHub.com has two possible versions:

Free, Pro, or Team plans

For Free, Pro, or Team plans on GitHub.com, use free-pro-team@latest. The short name is fpt.

GitHub Enterprise Cloud

For GitHub Enterprise Cloud, use enterprise-cloud@latest. The short name is ghec.

GitHub Enterprise Server

Documentation for GitHub Enterprise Server has multiple versions and can be divided into two types: documentation for supported releases (we support four at any one time), and documentation for closing down releases (we do not link to these on the Docs site but we support a "frozen" snapshot of these docs in perpetuity, so they can still be accessed if you know the URLs). See lib/enterprise-server-releases.js for a list.

The versions are named enterprise-server@<release>. The short name is ghes. In Liquid conditionals, we can specify ranges, like ghes > 3.0. For more information, see Versioning with Liquid conditional operators.

Versioning in the YAML frontmatter

You can use the versions property within a file's frontmatter to define which products an article will appear for. Index files require a versions property, but they will be automatically versioned based on the versions of their children.

For example, the following YAML frontmatter will version an article for GitHub Enterprise Server 2.20 and above and Free, Pro, or Team.

title: About your personal dashboard
versions:
  fpt: '*'
  ghes: '>=2.20'

The following example will version an article for all supported versions of GitHub Enterprise Server:

title: Downloading your license
versions:
  ghes: '*'

You can also version a page for a range of releases. The following example will version the page for Free, Pro, & Team, GitHub Enterprise Cloud, and GitHub Enterprise Server versions 3.1 and 3.2 only:

versions:
  fpt: '*'
  ghec: '*'
  ghes: '>=3.1 <3.3'
Versioning with Liquid conditional operators

We use the Liquid template language (specifically, this Node.js port) and a custom {% ifversion ... %} tag to create versions of our documentation.

If you define multiple products in the versions key within a page's YAML frontmatter, you can use the conditional operators ifversion/else (or ifversion/elsif/else) in the Markdown to control how the site renders content on the page for a particular product. For example, a feature may have more options on GitHub.com than on GitHub Enterprise Server, so you can version the content appropriately via the versions frontmatter, and use Liquid conditionals to describe the additional options for GitHub.com.

Note

Comparison operators

For versions that don't have numbered releases (like fpt and ghec), you have two options:

For versions that have numbered releases (currently only ghes), you can do the same for content that is either available in all of the releases or not available in any of the releases:

If you need to denote content that is only available (or not available) in certain releases, you can use the following operators:

Operator Meaning Example = Equal to {% ifversion ghes = 3.0 %} > Newer than {% ifversion ghes > 3.0 %} < Older than {% ifversion ghes < 3.0 %} != Not equal to {% ifversion ghes != 3.0 %} (don't use not in ranges)

The Liquid operators ==, >=, and <= are not supported in the GitHub Docs.

Logical operators

When all operands must be true for the condition to be true, use the operator and:

{% ifversion ghes > 2.21 and ghes < 3.1 %}

When at least one operand must be true for the condition to be true, use the operator or:

{% ifversion fpt or ghes > 2.21 %}

Do not use the operators && or ||. Liquid does not recognize them, and the content will not render in the intended versions.

Whitespace control

When using Liquid conditionals in lists, you can use whitespace control characters to prevent the addition of newlines and other whitespace that would break the list rendering.

You can add a hyphen (-) on either the left, right, or both sides to indicate that there should be no newline or other whitespace on that side.

{%- ifversion fpt %}

For example, to version one step of a procedure, instead of adding liquid versioning for the step starting at the end of the previous step, like this:

1. This step is for all versions{% ifversion ghes %}
1. This step is for GHES only{% endif %}
1. This step is for all versions

You can include the liquid versioning on its own line and use whitespace control to strip the newline to the left of the liquid tag. This makes reading the source much easier, without breaking the rendering of the list:

1. This step is for all versions
{%- ifversion ghes %}
1. This step is for GHES only
{%- endif %}
1. This row is for all versions
About feature-based versioning

When you document any new change or feature, use feature-based versioning.

A small minority of features and changes will only ever apply to one product. The majority of features come to GitHub.com and eventually reach all products. In general, changes "flow" from GitHub.com (including GitHub Enterprise Cloud) to GitHub Enterprise Server.

Feature-based versioning provides named "feature flags" that simplify the maintenance and versioning of documentation. You can use a single feature name (or "flag") to group and version prose throughout content. When a feature comes to additional products, you only need to make a change to the YAML versioning in the file within data/features/.

Managing features

Each feature is managed through individual YAML files in data/features/.

Note

Do not delete data/features/placeholder.yml because it is used by tests.

To create a new feature, first create a new YAML file with the feature name you want to use in this directory. For a feature named meow, that would be data/features/meow.yml.

Add a versions block to the YAML file with the short names of the versions the feature is available in. For example:

versions:
  fpt: '*'
  ghec: '*'
  ghes: '>3.1'

The format and allowed values are the same as the frontmatter versions property. For more information, see Versions in the github/docs repository README.

Liquid conditionals

Now you can use {% ifversion meow %} ... {% endif %} in content files!

Frontmatter

You can also use the feature in frontmatter in content files:

versions:
  feature: 'meow'

You can only use one feature entry under versions, and the value of feature can only contain one feature name.

You can combine feature-based versioning and standard versioning in frontmatter. When you do this the article will be included in the superset of all of the versions specified in the feature-based versioning file and directly in the Markdown file. For example, you might have a feature that is currently only available in GHEC, and this is specified in the feature-based versioning. However, you want the "About" article for this feature to also be visible in the FPT docs. In this case you could add fpt and feature to the versions block in the front matter:

versions:
  fpt: '*'
  feature: 'some-new-feature'
Best practices

Versioned content impacts the reader, but also impacts anyone who contributes to or reviews the content. Here are a few tips to improve the writing, reading, and reviewing experience for versioning syntax. None of these practices are mandatory and you will find edge and corner cases, but they're intended as useful heuristics to help you think through versioning.

Avoid unnecessary versioning

For the reader, gaining a general understanding is more important than reading details that precisely reflect the differences between particular products or plans. In conceptual or procedural content, try to describe features or portions of the UI in a general way that doesn't require versioning syntax. In addition to being easier for us to maintain, this strengthens understanding for readers who refer to documentation for multiple products.

When modifying an existing content file, review existing versioning early and often

Staying cognizant of existing versioning will help ensure that you write relevant versioning statements, and can help remind you to version new content accurately.

Avoid repetition as much as possible

Use versioning syntax within a sentence or paragraph to differentiate prose for two different plans or products. A contributor can edit just one paragraph with versioning statements, instead of needing to consider larger blocks of versioned text and modify similar but differently versioned prose in two places. A reviewer can suggest a change once, instead of needing to leave the same suggestion in multiple places. But if the behavior differs dramatically or versioning within the sentence or paragraph becomes complicated or difficult for a contributor to parse, consider repeating yourself to make the prose easier to maintain.

Be explicit, not implicit

If you know exactly which products the content describes, version explicitly for those products. Syntax like not, and else in particular, can be imprecise. The end result of not and else depend on each article's front matter, so a contributor must do more investigation to understand prose with this versioning. This creates the potential for errors. The complexity of implicit versioning increases in reusables, where articles that reference the reusable may have different versioning, and thus different evaluations of not or else. We also occasionally introduce a new version to GitHub Docs when GitHub introduces a new product, which changes the end result of not and else when we add the new version to existing articles.

Verify and communicate versioning as you work through content design and creation

Sometimes a change isn't included in the release it was originally intended for. You can save time for reviewers and ensure more accurate content by confirming versioning throughout content design and creation, for both releases and improvements.

Test, test, and test again

Whether you're writing the content or reviewing the content, pay attention to the content design plan and affected products, and check the rendered content in a staging or development environment to ensure that the content describes each product accurately.


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4