You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Variables example in creating-reusable-content uses tags that do not resolve #46875
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