Nesting variables in Jekyll/Liquid
<p><strong>Assumption</strong> - From what I understand, Liquid works in a way that the variable <code>page.my_key</code> can be compared to a PHP array with name <code>page</code> and key <code>my_key</code>: <code>$page['my_key']</code>. Following this same logic we could compare <code>{{ page.my_key }}</code> with <code>echo $page['my_key']</code>. </p>

<p>And we could compare this front matter:</p>

<pre><code>----
my_key: my_value
----
</code></pre>

<p>to this PHP code:</p>

<pre><code>$page['my_key'] = "my_value";
</code></pre>

<hr>

<p><strong>Question</strong> - I would like to do something like this:</p>

<pre><code>$page['my_key'] = "my_value";
$page['my_key2'] = "my_value2";
$key = "my_key";
echo $page[$key];
</code></pre>

<p>All I can think of is:</p>

<pre><code>----
my_key: my_value
my_key2: my_value2
----
{% assign key = 'my_key' %}
{{ page.{{ key }} }}
</code></pre>

<p>However, that does not work... Is something like this possible, though?</p>