view default/blog/articles.html @ 113:e96a3e09d4e9

blog/articles: use short dates when severals items are shown because the page is cached, and relative for single view.
author Goffi <goffi@goffi.org>
date Fri, 26 Jan 2018 07:51:58 +0100
parents e1a0d5678837
children 1d0ddeb79903
line wrap: on
line source

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

{% block title scoped -%}
    {%- if items|length == 1 -%}
        {{- items[0].title|default(items[0].content, true)|truncate(60, True, '…') + ' - ' + C.APP_NAME -}}
    {%- else -%}
        {{C.APP_NAME}}
        {# {{- super() -}}
           FIXME: super() is failing if blog is embedded (i.e. base/base.html is not its direct parent)
                  not sure what's the best way to avoid that, so just using C.APP_NAME for now #}
    {%- 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 %}