Skip to main content
GitHub Docs manages shared content through two complementary systems: reusables for multi-sentence blocks like paragraphs and procedural steps, and variables for short strings like product names and URLs. Both are stored under data/ and inserted into content files using the {% data %} Liquid tag.

How they differ

Variables

Variables are short strings stored in YAML files under data/variables/. Each file groups related variables together. The path to a variable in the {% data %} tag matches the directory path and key within the YAML file.

Referencing variables

Given the file structure:
Variables are referenced as:

Product name variables

The most commonly used variables are in data/variables/product.yml. Use these consistently instead of hardcoding product names — they allow for centralized updates and correct localization.
Some variables use {% ifversion %} internally to return different strings depending on the current version context. For example:
When referenced as {% data variables.product.prodname_container_registry_namespace %}, this renders ghcr.io on GitHub.com and a hostname-relative URL on GitHub Enterprise Server.

Creating a new variable

1

Choose or create a YAML file

Find the relevant file in data/variables/ (for example, product.yml for product names, actions.yml for Actions-specific strings). Create a new file only if no existing file fits the category.
2

Add the key-value pair

Add a descriptive key and its string value:
For nested variables:
Reference nested variables as {% data foo.bar.nested.values.label %}.
3

Reference it in content

Use the {% data %} tag with the full dotted path:

Reusables

Reusables are longer Markdown content blocks — paragraphs, steps, tables — that appear in multiple articles. Each reusable lives in its own .md file under data/reusables/.

Referencing reusables

Given the file data/reusables/repositories/navigate-to-repo.md, reference it as:
The dotted path maps directly to the directory structure and filename (without the .md extension).

Real examples

Common reusables used throughout the GitHub Docs source:
A reusable file can contain any valid Markdown, including Liquid conditionals:

Reusables in ordered lists

When a reusable appears as a step inside an ordered list, use indented_data_reference with a spaces argument to preserve list indentation:
The spaces value is the number of spaces the reusable lines should be indented, matching the list item indentation level.

Creating a new reusable

1

Identify the right directory

Reusables are organized by task or product area. Look in data/reusables/ for a directory that fits your content. For example:
  • data/reusables/actions/ for GitHub Actions steps
  • data/reusables/repositories/ for repository navigation steps
  • data/reusables/organizations/ for organization management steps
Create a new directory only if no existing directory fits.
2

Create the Markdown file

Create a new .md file with a descriptive kebab-case name:
3

Write the content

Write valid Markdown. You can use Liquid variables and conditionals inside reusables:
4

Reference it in content

Add the {% data %} tag wherever the reusable should appear:
Do not edit a reusable without checking all articles that reference it. Changes affect every page that includes the reusable. Search the content/ directory for reusables.your.reusable-name before making modifications.

When to use reusables vs. variables

Use a variable

  • Product names and trademarked strings
  • Short UI labels that appear inline in sentences
  • URLs that may change across versions
  • Strings fewer than one sentence long

Use a reusable

  • Navigation steps repeated across multiple how-to articles
  • Prerequisite paragraphs shared by related articles
  • Permission statements used by multiple pages
  • Any content block longer than one sentence

Versioning reusables and variables

Both reusables and variable values support Liquid version conditionals. This lets a single shared string serve all versions without duplicating files.

Versioned variable value

Versioned reusable content

Reusables that include Liquid conditionals inherit their version context from the page that includes them — the same version the reader is currently viewing.

Directory structure reference