Given this YAML:
- maincategory:
title: "Projects"
subcategory:
title: "General"
item:
title: "Alpha"
item:
title: "Beta"
- maincategory:
title: "Support"
subcategory:
title: "General"
item:
title: "Something"
item:
title: "Else"
How to iterate over this data if the Jekyll _data file is called entries.yml?
So far I have gotten here, but I'm not sure if I should continue to reference the site.data file in sub-loops. Also not sure if this is possible.
{% for entry in site.data.entries %}
<h2>{{ entry.maincategory.title }}</h3>
{% for subcategory in site.data.entries.maincategories %}
<h3>{{ entry.maincategory.subcategory.title }}</h3>
<ul>
{% for item in site.data.entries.maincategory.subcategories %}
<li><a href="{{ item.href }}">{{ item.title }}</a></li>
{% endfor %}
</ul>
{% endfor %}
{% endfor %}
To be clear, this is where I want to end (wise conclusion):
<h2>Main category title</h2>
<h3>Subcategory title</h3>
<ul>
<li><a href="#">Item title</a>
</li>
Wolfr source
share