{% for post in latest_posts %}
    {% set o = post_overrides[post.ID]|default({}) %}
    {% set bgUrl = o.background_url|default(post.thumbnail) %}
    {% set customDescHtml = o.description_html|default('') %}
    {% set hideReadMore = o.hide_read_more_button|default(true) %}
    {% set textVertAlign = o.text_vertical_alignment|default('align-content-center') %}
    {% set contentClass = 'latest-posts-block-grid__item ' ~ textVertAlign %}


    <div class="{{ 'position-relative ' ~ block_col_class|default('col') }}">
    {% if hideReadMore %}
        <a href="{{ post.link }}" class="full-block-link" aria-label="{{ post.title }}"></a>
    {% endif %}
        <div
                class="{{ contentClass }}"
                {% if bgUrl %}
                    style="background-image:url('{{ bgUrl }}'); background-size:cover; background-position:center;"
                {% endif %}
        >
            <h3>{{ post.title }}</h3>

            {% if customDescHtml %}
                <div class="description">{{ customDescHtml }}</div>
            {% elseif post.excerpt %}
                <div class="description">{{ post.excerpt({ read_more: '' }) }}</div>
            {% endif %}

            {% if not hideReadMore %}
            <a class="btn btn-primary" href="{{ post.link }}">Read more</a>
            {% endif %}
        </div>
    </div>
{% endfor %}