FHIR Chat · Liquid help · IG creation

Stream: IG creation

Topic: Liquid help


view this post on Zulip Jose Costa Teixeira (Oct 03 2021 at 10:00):

Question about liquid syntax: Can we evaluate a variable to define another variable?
I.e. I have a myPath variable (using a simple example value)

{% assign myPath= "ig.id" %}

and I want jekyll to evaluate not the path, but the variable that is pointed by the path

{% assign myPathValue= site.data.values.{{myPath}} %}

I want to evaluate the expression site.data.values.ig.id
How would I do this? The nested curly syntax is not supposed to work, does anyone know a way to do this?

view this post on Zulip Jose Costa Teixeira (Oct 03 2021 at 13:59):

Update: the out-of-the-box solution works, I just hadn't done it right.
For anyone who cares, the way to include variables inside liquid is

{% assign myPathValue= site.data.values[myPath] %}

Last updated: Apr 12 2022 at 19:14 UTC