layout: contained
{% assign allPosts = site.posts %} <!– filter posts for category –> {% if page.category %}
{% assign catPosts = allPosts | where: "categories", page.category %}
{% else %}
{% assign catPosts = allPosts %}
{% endif %} <!– filter posts for tag –> {% if page.tag %}
{% assign posts = catPosts | where: "tags", page.tag %}
{% else %}
{% assign posts = catPosts %}
{% endif %}
<div class=“row mb-5”> {% for post in posts %}
<div class="col-md-4 col-sm-6 portfolio-item"> <a class="d-block" href="{{ post.url }}"> <div class="img-34" style="background-image:url('{{ post.img_v }}')"></div> <h2 class="mt-2 mb-4 text-center">{{ post.title }}</h2> </a> </div>
{% endfor %} </div>