1
votes

Given this JSON:

case studies: [
  [ "Nubaru",
    ["Nubaru Yearly Report", "Web design", "2013", "/case-studies/Nubaru.html", "/images/case-studies/Nubaru.png"]
  ],
  [ "Ekande",
    ["Ekande application", "Web application design", "2013", "/case-studies/Ekande.html", "/images/case-studies/Ekande.png"]
  ]
]

And this Liquid (using Jekyll):

<ul>
{% for items in page.case-studies %}
  {% for item in items %}
    <li>
      {{ item }}
      <!-- How to get sub items? -->
    </li>
  {% endfor %}
{% endfor %}
</ul>
  • How would I access the data in the inner array?
  • Is there a way to name the data so I might access it like this: {{ case-study.date }}?
1

1 Answers

2
votes

For the first question, have you tried using a third loop like {% for subItem in {{ item[2] }} %}, or accessing directly, like for the data {{ item[2][3] }} ?

For the second one, you can use {% assign %} like this: {% assign caseDate = 'your-value' %}, cf. http://wiki.shopify.com/Liquid#Variable_Assignment