{% set content = child.content|first %}
{% set link = menu.parent ? path('template_level3', {idlevel1:menu.parent.id, titlelevel1:menu.parent.slug, idlevel2:menu.id, titlelevel2:menu.slug, id:child.id, title:child.slug}) : path('template_level2', {idlevel1:menu.id, titlelevel1:menu.slug, id:child.id, title:child.slug})  %}

{% set picture = content.getWebPath() %}
{% if picture is empty or picture == '/' %}
    {% for media in child.media if media.type == constant('AppBundle\\Enum\\MediaType::PICTURE') %}
        {% if picture is empty or picture == '/' or picture == (media.getUploadDir() ~ '/') %}
            {% set picture = media.getWebPath() %}    
        {% endif %}
    {% endfor %}
{% endif %}
<article class="item">
    <div class="item-content">
        <figure class="img-block">
            {% if picture is not empty and picture != '/' and picture != (child.media|first.getUploadDir() ~ '/') %}
                <img src="{{ asset(picture|imagine_filter('500L')) }}" alt="{{ content.title }}" class="img-fluid" />
            {% endif %}
        </figure>
            
        <header>
            <h3 class="item-title h5 text-no-transform">
                <a href="{{ link }}">
                    {{ content.title }}
                </a>
            </h3>
        </header>

        {#<div class="item-desc">{{ content.article|striptags|truncate(300, false, '…')|raw }}</div>#}

        <footer class="item-more-actions">
            <p>
                <a class="btn btn-xs btn-white" href="{{ link }}">
                    {{ 'word.learn_more'|trans({}, 'word') }}
                </a>
            </p>
        </footer>
    </div>
</article>