{% set posts = __SELF__.posts %}

<h2>{{ 'Search Results for:'|_ }} {{ __SELF__.searchTerm }}</h2>

<ul class="post-list">
    {% for post in posts %}
    <li>
        <h3><a href="{{ post.url }}">{{ post.title|raw }}</a></h3>

        <p class="info">
            {{ 'Posted'|_ }}
            {% if post.categories.count %} {{ 'in'|_ }} {% endif %}
            {% for category in post.categories %}
            <a href="{{ category.url }}">{{ category.name }}</a>{% if not loop.last %}, {% endif %}
            {% endfor %}
            {{ 'on'|_ }} {{ post.published_at|date('M d, Y') }}
        </p>

        {% if post.excerpt %}
        <p class="excerpt">{{ post.excerpt|raw }}</p>
        {% else %}
        <div class="content">{{ post.content_html|raw }}</div>
        {% endif %}
    </li>
    {% else %}
    <li class="no-data">{{ noPostsMessage }}</li>
    {% endfor %}
</ul>

{% partial __SELF__~"::pagination" posts=posts %}