{%- assign posts = site.posts -%}

{%- if page.lang != null -%}

{%- assign posts = site.posts | where: "lang", page.lang -%}

{%- endif -%}

{%- assign limit = null -%}

{%- if site.waterfall.home.last_posts_items -%}

{%- assign limit = site.waterfall.home.last_posts_items -%}

{%- endif -%}

{%- if page.last_posts_items -%}

{%- assign limit = page.last_posts_items -%}

{%- endif -%}

<div id=“last-posts” class=“min-h-screen pt-32”>

<h2 class="text-primary-700 mb-10 text-3xl">Last Posts</h2>
<div class="row">
   {% for post in posts limit: limit %}
      <div class="col w-full sm:w-1/2 md:w-1/3">
         <a href="{{ post.url }}" class="card p-5 bg-gray-50 dark:bg-gray-800 hover:shadow-lg rounded-md relative transition-all border-t-4 border-primary-600 block mb-3">
            <h2 class="text-gray-800 dark:text-gray-100 text-xl mb-3">{{ post.title }}</h2>
            <p class="text-gray-500">{{ post.excerpt }}</p>

            <div class="absolute bottom-0 py-5">
               {% for category in post.categories %}
                  <span class="text-gray-400 text-sm">{{ category }}</span>
               {% endfor %}
            </div>
         </a>
      </div>
   {% endfor %}
</div>

{%- if page.posts -%}
   <div class="flex justify-center my-5">
      <a href="{{ page.posts.url }}" class="btn border-primary-700 border rounded-md text-center text-primary-700 hover:bg-primary-700 hover:text-white transition-all">{{ page.posts.see_more_label }}</a>
   </div>
{%- endif -%}

</div>