comparison default/blog/articles.html @ 114:1d0ddeb79903

blog/article: set "single" variable when a single article is shown, and expand items in this case
author Goffi <goffi@goffi.org>
date Fri, 26 Jan 2018 07:52:41 +0100
parents e96a3e09d4e9
children 5d9e2270ceb4
comparison
equal deleted inserted replaced
113:e96a3e09d4e9 114:1d0ddeb79903
1 {% if not embedded %}{% extends 'base/base.html' %}{% endif %} 1 {% if not embedded %}{% extends 'base/base.html' %}{% endif %}
2 {% set single = items|length == 1 %}
2 {% set dates_format='relative' if single else 'short' %} 3 {% set dates_format='relative' if single else 'short' %}
3 {% import 'blog/macros.html' as blog with context %} 4 {% import 'blog/macros.html' as blog with context %}
4 5
5 {% block title scoped -%} 6 {% block title scoped -%}
6 {%- if items|length == 1 -%} 7 {%- if single -%}
7 {{- items[0].title|default(items[0].content, true)|truncate(60, True, '…') + ' - ' + C.APP_NAME -}} 8 {{- items[0].title|default(items[0].content, true)|truncate(60, True, '…') + ' - ' + C.APP_NAME -}}
8 {%- else -%} 9 {%- else -%}
9 {{C.APP_NAME}} 10 {{C.APP_NAME}}
10 {# {{- super() -}} 11 {# {{- super() -}}
11 FIXME: super() is failing if blog is embedded (i.e. base/base.html is not its direct parent) 12 FIXME: super() is failing if blog is embedded (i.e. base/base.html is not its direct parent)
13 {%- endif -%} 14 {%- endif -%}
14 {%- endblock title -%} 15 {%- endblock title -%}
15 16
16 {% block body %} 17 {% block body %}
17 <div id="blog_items"> 18 <div id="blog_items">
18 {{ blog.show_items(items) }} 19 {{ blog.show_items(items, expanded=single) }}
19 </div> 20 </div>
20 <nav class="bottom_links"> 21 <nav class="bottom_links">
21 <ul> 22 <ul>
22 {% if newer_url is defined %} 23 {% if newer_url is defined %}
23 <li class="newer_items"> 24 <li class="newer_items">