view default/blog/articles.html @ 102:7108731be0b9

blog/articles: don't set content in title block if embedded, to avoid exception with missing parent title
author Goffi <goffi@goffi.org>
date Mon, 22 Jan 2018 08:46:07 +0100
parents e4ffb56efd4e
children e1a0d5678837
line wrap: on
line source

{% if not embedded %}{% extends 'base/base.html' %}{% endif %}
{% set dates_format='relative' %}
{% import 'blog/macros.html' as blog with context %}

{% block title -%}
    {%- if not embedded -%}
        {%- if items|length == 1 -%}
            {{- items[0].title|default(items[0].content, true)|truncate(60, True, '…') + ' - ' + C.APP_NAME -}}
        {%- else -%}
            {{- super() -}}
        {%- endif -%}
    {%- endif -%}
{%- endblock title -%}

{% block body %}
<div id="blog_items">
    {{ blog.show_items(items) }}
</div>
<nav class="bottom_links">
    <ul>
        {% if newer_url is defined %}
            <li class="newer_items">
                <a href="{{newer_url}}">
                    <img src="{{media_path}}icons/tango/actions/32/go-previous.png">
                    {% trans %}newer articles{% endtrans %}
                </a>
            </li>
        {% endif %}
        {% if older_url is defined %}
            <li class="older_items">
                <a href="{{older_url}}">
                    <img src="{{media_path}}icons/tango/actions/32/go-next.png">
                    {% trans %}older articles{% endtrans %}
                </a>
            </li>
        {% endif %}
    </ul>
</nav>
{% endblock body %}