Skip to content

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

Closed

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
  2. subatoi commented on Nov 9, 2026

    @subatoi
    Contributor

    @ZainnQureshii Thanks for raising an issue; you're right to highlight that some of this content does need updating, but we can't accept community contributions for it, so unfortunately I've closed your PR out and I'm going to mark this to fix internally, and take an action to refine some of the content as appropriate. Sorry this won't have been the outcome you were hoping for, but thank you for your interest in the GitHub docs. Please feel free to keep an eye out for issues marked help wanted.

  3. added
    fix-internallyTriggers a workflow to copy the issue internally and close the current issue
    on Nov 9, 2026
  4. docs-bot commented on Nov 9, 2026

    @docs-bot
    Collaborator

    Thank you for opening this issue! Updates to this documentation must be made internally. I have copied your issue to an internal issue, so I will close this issue.

  5. subatoi commented on Nov 10, 2026

    @subatoi
    Contributor

    @ZainnQureshii Just to follow up, I fixed this internally and added you as a co-committer. You should see the commit visible within the next 24 hours

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

    fix-internallyTriggers a workflow to copy the issue internally and close the current issuetriageDo 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