Working on project this evening I found myself wanting to use the current content of a page variable as part of the key to later variable.

At first I thought it was not practical but after a little experimentation I found a method.

Imagine a situation where you have a list of people and you wish to find data on posts under a key of their own name,

Example post yaml,

---<br /> layout: post<br /> date: '2013-01-01'<br /> John Smith: I like this<br /> Bob Green: I do not like this<br /> ---

Example page yaml,

` —
reviewers:

  • John Smith
  • Bob Green
    —</p>`

{% for person in page.reviewers %}
{{person}} {% for post in site.posts %}</p> {{post.[person]}} {% endfor %} {% endfor %}

This is the key bit

{{post.[person]}}

The square brackets around the variable name cause its value to be used, not its name.

New Glass Lumix H014AE

New glass for the new camera. Continue reading

Getting a new camera

Published on July 05, 2018

An Image Building and Sky

Published on June 10, 2018