Skip to content

Fix variable examples in reusable content docs - #46876

Draft
ZainnQureshii wants to merge 1 commit into
github:mainfrom
ZainnQureshii:docs/variables-examples
Draft

ZainnQureshii wants to merge 1 commit into
github:mainfrom
ZainnQureshii:docs/variables-examples

Conversation

@ZainnQureshii

Copy link
Copy Markdown

Why:

Closes: #46875

What's being changed (if available, include any code snippets, screenshots, or gifs):

The variables example in creating-reusable-content.md and in data/variables/README.md shows tags that do not resolve, so this updates both copies. The tags now start with variables., which getDataByDir in src/data-directory/lib/get-data.ts needs before it reads data/variables/, and the nested block is replaced with a second top-level key, because the last two segments of the tag are taken as the file and the key. 42 is quoted as well, since a bare number reaches gray-matter as a number and it throws "expected input to be a string or buffer".

I checked it by running the current getDataByDir against a foo/bar.yml fixture with the repo's js-yaml (5.4.1, the version in package-lock.json) and @gr2m/gray-matter (4.0.3-with-pr-137). The old tags fail and {% data variables.foo.bar.meaning_of_life %} and {% data variables.foo.bar.affirmative %} render 42 and Yes!. I did not run the full site or its linters locally, because they need Node 26.

AI disclosure: Claude Code (Anthropic) found and traced this, made the change and wrote this description. Could a maintainer add the llm-generated label, please?

Check off the following:

  • A subject matter expert (SME) has reviewed the technical accuracy of the content in this PR. In most cases, the author can be the SME. Open source contributions may require an SME review from GitHub staff.
  • The changes in this PR meet the docs fundamentals that are required for all content.
  • All CI checks are passing and the changes look good in the review environment.

🤖 Generated with Claude Code

Data tags for variables need the variables. prefix, the last two segments
of a tag are read as the file and the key so nested keys do not resolve,
and a bare 42 loads as a number, which gray-matter rejects, so the
documented tags did not render.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@github-actions github-actions Bot added the triage Do not begin working on this issue until triaged by the team label Nov 8, 2026
@github-actions

github-actions Bot commented Nov 8, 2026

Copy link
Copy Markdown
Contributor

How to review these changes 👓

Thank you for your contribution. To review these changes, choose one of the following options:

A Hubber will need to deploy your changes internally to review.

Table of review links

Note: Please update the URL for your staging server or codespace.

The table shows the files in the content directory that were changed in this pull request. This helps you review your changes on a staging server. Changes to the data directory are not included in this table.

Source Review Production What Changed
contributing/writing-for-github-docs/creating-reusable-content.md fpt
ghec
ghes@ 3.22 3.21 3.20 3.19
fpt
ghec
ghes@ 3.22 3.21 3.20 3.19

Key: fpt: Free, Pro, Team; ghec: GitHub Enterprise Cloud; ghes: GitHub Enterprise Server

🤖 This comment is automatically generated.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

triage Do not begin working on this issue until triaged by the team

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Variables example in creating-reusable-content uses tags that do not resolve

1 participant