From 5e00746a0dea9b6f9f350a26d51a4a57f0ed6d5e Mon Sep 17 00:00:00 2001 From: ZainnQureshii <43629888+ZainnQureshii@users.noreply.github.com> Date: Sun, 8 Nov 2026 13:37:14 +0100 Subject: [PATCH] Fix variable examples in reusable content docs 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 --- .../creating-reusable-content.md | 9 +++------ data/variables/README.md | 11 ++++------- 2 files changed, 7 insertions(+), 13 deletions(-) diff --git a/content/contributing/writing-for-github-docs/creating-reusable-content.md b/content/contributing/writing-for-github-docs/creating-reusable-content.md index 4f8424015ffc..823fc23f163d 100644 --- a/content/contributing/writing-for-github-docs/creating-reusable-content.md +++ b/content/contributing/writing-for-github-docs/creating-reusable-content.md @@ -38,12 +38,9 @@ For example, this YAML file, `{% raw %}data/variables/foo/bar.yml{% endraw %}`, ```yaml # the YAML file can contain multiple short strings in one file -meaning_of_life: 42 +meaning_of_life: '42' -# the strings can also be nested if needed -nested: - values: - too: Yes! +affirmative: Yes! ``` -The values would be accessible as `{% raw %}{% data foo.bar.meaning_of_life %}{% endraw %}` and `{% raw %}{% data foo.bar.nested.values.too %}{% endraw %}`. +The values would be accessible as `{% raw %}{% data variables.foo.bar.meaning_of_life %}{% endraw %}` and `{% raw %}{% data variables.foo.bar.affirmative %}{% endraw %}`. diff --git a/data/variables/README.md b/data/variables/README.md index f8fa22a8e6b8..5b3b589565a1 100644 --- a/data/variables/README.md +++ b/data/variables/README.md @@ -10,18 +10,15 @@ For example, given a file `data/variables/foo/bar.yml`: ```yaml # multiple short strings in one file -meaning_of_life: 42 +meaning_of_life: '42' -# and they can be nested if needed -nested: - values: - too: Yes! +affirmative: Yes! ``` Its values would be accessible as: ``` -{% data foo.bar.meaning_of_life %} +{% data variables.foo.bar.meaning_of_life %} -{% data foo.bar.nested.values.too %} +{% data variables.foo.bar.affirmative %} ```