I want to automatically display a gallery for page.attachments, but only if the page has multiple image attachment. Is there a _count variable for page.attachments or another way to get the array count? Seems like a simple task, but the API isn't showing anything.
Something like this:
{% if page.attachments_count > 1 %}
{% include "gallery" %}
{% endif %}
That obviously doesn't work since _count isn't a variable. Though it should be!
Official response from Jacob Green
You should be able to use "page.attachments.size".
Share this post
Showing 4 reactions
Sign in with