comparison default/blog/articles.html @ 95:e4ffb56efd4e

blog/articles: if only one item is shown, use it's title or content as page title.
author Goffi <goffi@goffi.org>
date Fri, 19 Jan 2018 18:17:06 +0100
parents 650f3456f80d
children 7108731be0b9
comparison
equal deleted inserted replaced
94:304cbb690f15 95:e4ffb56efd4e
1 {% if not embedded %}{% extends 'base/base.html' %}{% endif %} 1 {% if not embedded %}{% extends 'base/base.html' %}{% endif %}
2 {% set dates_format='relative' %} 2 {% set dates_format='relative' %}
3 {% import 'blog/macros.html' as blog with context %} 3 {% import 'blog/macros.html' as blog with context %}
4
5 {% block title -%}
6 {%- if items|length == 1 -%}
7 {{- items[0].title|default(items[0].content, true)|truncate(60, True, '…') + ' - ' + C.APP_NAME -}}
8 {%- else -%}
9 {{- super() -}}
10 {%- endif -%}
11 {%- endblock %}
4 12
5 {% block body %} 13 {% block body %}
6 <div id="blog_items"> 14 <div id="blog_items">
7 {{ blog.show_items(items) }} 15 {{ blog.show_items(items) }}
8 </div> 16 </div>