kolber / stacey

Cheap & easy content management
http://staceyapp.com
MIT License
1.04k stars 132 forks source link

Getting at Image assets in children (objects?) #94

Closed russellbits closed 11 years ago

russellbits commented 11 years ago

I'm creating a one page Stacey portfolio, so I need to be able to get at images in subdirectories in my default.html. The below code that I'm using does not appear to be working.

{% for child in page.root %}
{% if child.children %}

{% for child in child.children %}
<div class="item">
{{ child.title }} - {{ child.type }}

{% for image in child.image %}
{{ image.name }} <-- this returns nothing right now
{% endfor %}
</div>

{% endif %}
{% endfor %}
russellbits commented 11 years ago

Well that was silly. There's nothing wrong with the above code. The array to access assets is plural though, so

{% for image in child.images %}

Just needed an 's' — that's it!