src/templates/blog-listings.html.twig
<ul class="breadcrumb">
{% for name, href in breadcrumbs %}
{% if loop.last %}
{% if search %}
<li class="active">Search: {{ search|escape }}</li>
{% else %}
<li class="active">{{ name }}</li>
{% endif %}
{% else %}
<li><a href="{{ href }}">{{ name }}</a></li>
{% endif %}
{% endfor %}
</ul>
{% if search %}
{% if blog.page == 'index' %}
{{ page.set('title', 'Search: ' ~ search|escape('html_attr') ~ ' @ ' ~ blog.name) }}
{% elseif blog.page == 'category' %}
{{ page.set('title', 'Search: ' ~ search|escape('html_attr') ~ ' @ ' ~ category|join(' » ')) }}
{% endif %}
{% elseif blog.page == 'index' %}
{{ page.set('title', blog.name) }}
{% elseif blog.page == 'category' %}
{{ page.set('title', category|join(' » ') ~ ' @ ' ~ blog.name) }}
{% elseif blog.page == 'archives' %}
{% if archive|length == 4 %}
{% set date = archive.date|date('F j, Y') %}
{% elseif archive|length == 3 %}
{% set date = archive.date|date('F Y') %}
{% elseif archive|length == 2 %}
{% set date = archive.date|date('Y') %}
{% endif %}
{{ page.set('title', date ~ ' Archives @ ' ~ blog.name) }}
{% elseif blog.page == 'authors' %}
{{ page.set('title', author.name ~ ' @ ' ~ blog.name) }}
{% elseif blog.page == 'tags' %}
{{ page.set('title', tag.name ~ ' @ ' ~ blog.name) }}
{% endif %}
{% if not pagination.set('page', 10) %}
{{ pagination.total(blog.query(listings, 'count')) }}
{% endif %}
{% set posts = blog.query(listings, pagination) %}
{% for post in posts %}
<article itemscope itemtype="http://schema.org/Article">
<h2 itemprop="name"><a href="{{ post.url }}">{{ post.title }}</a></h2>
<p>
{% if post.page.image %}
<a href="{{ post.url }}"><img itemprop="image" src="{{ post.page.image }}?w=250&h=200" alt="{{ post.title }}" class="img-responsive" style="float:left; margin-right:15px;"></a>
{% endif %}
{% if search %}
{{ post.snippet }}
{% else %}
<span itemprop="headline">{{ post.content|striptags|length > 500 ? post.content|striptags|slice(0,500) ~ '…' : post.content|striptags }}</span>
{% endif %}
</p>
<a href="{{ post.url }}">Read more →</a>
</article>
{% endfor %}
{{ pagination.pager() }}