Skip to content

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

Open

Description

@ZainnQureshii

Code of Conduct

What article on docs.github.com is affected?

https://docs.github.com/en/contributing/writing-for-github-docs/creating-reusable-content#about-variables

The same example is also in data/variables/README.md.

What part(s) of the article would you like to see updated?

The variables example says the values in data/variables/foo/bar.yml are reachable as {% data foo.bar.meaning_of_life %} and {% data foo.bar.nested.values.too %}, but neither tag works if you copy it. getDataByDir in src/data-directory/lib/get-data.ts only reads variables when the path starts with variables., so both tags fail with "Can't find the key", and with the prefix added the nested one still fails because the last two segments are taken as the file and the key, so it looks for data/variables/foo/bar/nested/values.yml. The value also has to be a string, because a bare 42 is loaded as a number and gray-matter throws "expected input to be a string or buffer" on it.

So the example should quote '42', swap the nested block for a second top-level key, and show the tags as {% data variables.foo.bar.<key> %}, which is the form all the real tags in content/ and data/ use.

Additional information

I checked it by running the current getDataByDir against a foo/bar.yml fixture with the repo's js-yaml and gray-matter versions, where the documented tags fail and the fixed ones render 42 and Yes!. Claude Code helped me trace this through the code, and I'll open a PR with the fix.

Activity

  1. added
    triageDo not begin working on this issue until triaged by the team
    on Nov 8, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    triageDo not begin working on this issue until triaged by the team

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions