{% extends "base.twig" %}

{% block content %}

    {% include 'blocks/page-header.twig' %}

    {% if posts.post_count == 0 %}
        {{ __('Sorry, no results were found.', 'sage') }}
        {{ function('get_search_form') }}
    {% endif %}

    {% for post in posts %}
        {% include "templates/blocks/content.twig" with {post: post}  %}
    {% endfor %}

    {{ function('the_posts_navigation') }}

{% endblock %}

{% extends "base.twig" %}

{% block content %}

    {% include 'blocks/page-header.twig' %}

    {% if posts == [] %}
        {{ __('Sorry, no results were found.', 'sage') }}
        {{ function('get_search_form') }}
    {% endif %}

    {% for post in posts %}
        {% include "templates/blocks/content.twig" with {post: post}  %}
    {% endfor %}

    {{ function('the_posts_navigation') }}

{% endblock %}

Fix check for empty posts array
Fix check for empty posts array

The conditional for posts.post_count == 0 didn't work; I could see the "Sorry, no results" text on every search page, even one with results. It looks like simply checking against an empty array works as expected.