comparison 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
comparison
equal deleted inserted replaced
101:920f03abba53 102:7108731be0b9
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 4
5 {% block title -%} 5 {% block title -%}
6 {%- if items|length == 1 -%} 6 {%- if not embedded -%}
7 {{- items[0].title|default(items[0].content, true)|truncate(60, True, '…') + ' - ' + C.APP_NAME -}} 7 {%- if items|length == 1 -%}
8 {%- else -%} 8 {{- items[0].title|default(items[0].content, true)|truncate(60, True, '…') + ' - ' + C.APP_NAME -}}
9 {{- super() -}} 9 {%- else -%}
10 {{- super() -}}
11 {%- endif -%}
10 {%- endif -%} 12 {%- endif -%}
11 {%- endblock %} 13 {%- endblock title -%}
12 14
13 {% block body %} 15 {% block body %}
14 <div id="blog_items"> 16 <div id="blog_items">
15 {{ blog.show_items(items) }} 17 {{ blog.show_items(items) }}
16 </div> 18 </div>