I'm working on a basic portfolio site wherein each entry or "project" has a body Matrix field with various blocks for various types of images.
I'd like to make an index of all projects showing one slideshow/carousel for each project containing all images within that project.
The problem is that I don't know how to query all images at once.
= All images, all blocks, in the order they appear in the entry.
Any help?Here's my specific code in use. It's almost there but due to the 0
in image[0]
it's only pulling in the first image from each instance of each Matrix Block. For example, there are two instances of the block called imageHalf
and it pulls the first image from each.
I don't understand how to avoid this integer....
{% for block in entry.body %}
{% switch block.type %}
{% case "imageFull" %}
{% set image = block.image.total() %}
<a href="{{ entry.url }}"><img data-lazy="
{{ block.image[0].getUrl() }}
" /></a>
{% case "imageHalf" %}
<a href="{{ entry.url }}"><img data-lazy="
{{ block.image[0].getUrl() }}
" /></a>
{% case "imageCouple" %}
<a href="{{ entry.url }}"><img data-lazy="
{{ block.image[0].getUrl() }}
" /></a>
{% endswitch %}
{% endfor %}