How to get variables programtically?

I want to do something like this:


For example:
I have 3 files:


	"twitter": "{url}",
	"linkedin": "{url}&title=title&summary=summary"


shareOn: 'twitter'


{{ $.Site.Data.Social.[.Params.shareOn] }}

Result is expected to return{url}

Is there anyway to do so?

[Update - same date - 11h +7] Add context. Sorry about this, I wrote this on tablet so it’s lack of context. I hope my update will make my question be more clear. Btw, @zwbetz suggestion seems like the one I need. I will report immediately after I try it. Thanks :slight_smile:

You’ll need to give a little more information for us to help. Maybe a copy of the data file and a snippet of the code you’re using to process it. Or even better, a link to your whole repository.

1 Like

As @funkydan2 mentioned, we need more context.

Off the top of my head, though, try something like:

{{ index $.Site.Data }}

If your had a value of foo, then the above would be equivalent to:

{{ $ }}