{% load cms_tags i18n thumbnail %}

<div class="gallery" itemscope itemtype="http://schema.org/ImageGallery">
    {% for file in instance.folder.files %}
        <div class="gallery__item">
            {% thumbnail file 2000x2000 as full %}
            {% thumbnail file 500x500 as thumb %}
            <div class="gallery__item__main reveal_self reveal reveal_animation"
                 style="background-image: url({{ thumb.url }})">
                <figure itemprop="associatedMedia" itemscope
                        itemtype="http://schema.org/ImageObject">
                    <a href="{{ full.url }}" class="event"
                       itemprop="contentUrl"
                       data-size="{{ full.width }}x{{ full.height }}">
                        <img src="{{ thumb.url }}"
                             itemprop="thumbnail"
                             alt="{{ file.name }}"/>
                    </a>
                    {% if file.description %}
                        <figcaption itemprop="caption description">{{ file.description }}</figcaption>
                    {% endif %}
                </figure>
            </div>
        </div>
    {% endfor %}
</div>