# How to access \`site.data\[“foo.bar.baz”\]\` if \`foo.bar.baz\` is a FrontMatter variable

**URL:** <https://talk.jekyllrb.com/t/how-to-access-site-data-foo-bar-baz-if-foo-bar-baz-is-a-frontmatter-variable/3476>\
**Category:** Help\
**Created:** [October 19, 2019, 3:50pm UTC](https://talk.jekyllrb.com/t/how-to-access-site-data-foo-bar-baz-if-foo-bar-baz-is-a-frontmatter-variable/3476 "2019-10-19T15:50:00Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![kirbelots](https://avatars.discourse-cdn.com/v4/letter/k/c67d28/32.png) [@kirbelots](https://talk.jekyllrb.com/u/kirbelots)\
**Post date:** [October 19, 2019, 3:50pm UTC](https://talk.jekyllrb.com/t/how-to-access-site-data-foo-bar-baz-if-foo-bar-baz-is-a-frontmatter-variable/3476/1 "2019-10-19T15:50:00Z")

</div>

I want something like:

```auto
---
my_var: "foo.bar.baz"
---

{{- site.data[page.my_var] -}}

```

Unfortunately, it doesn’t work…

I know that I can use `site.data.foo.bar.baz`or `site.data["foo"]["bar"]["baz"]`, but it’s not that.

Also I know that I can split `page.my_var` to substrings and use them then as `site.data["foo"]["bar"]["baz"]`. But this increases Jekyll build time.

I guess I need some Ruby plugin, but don’t know one and I don’t know Ruby to write one.

_If you know such plugin or can help me write one or know some native workaround, this would be sooo great!_

Help 🙂

---

<div class="post-metadata">

**Author:** ![jonphipps](https://yyz2.discourse-cdn.com/flex030/user_avatar/talk.jekyllrb.com/jonphipps/32/2229_2.png) [@jonphipps](https://talk.jekyllrb.com/u/jonphipps)\
**Post date:** [February 1, 2020, 12:51pm UTC](https://talk.jekyllrb.com/t/how-to-access-site-data-foo-bar-baz-if-foo-bar-baz-is-a-frontmatter-variable/3476/2 "2020-02-01T12:51:34Z")

</div>

I have the same problem. Did you ever figure this out?
